Displaying 20 results from an estimated 4000 matches similar to: "String manipulation"
2012 Jun 03
2
merging single column from different dataframe
Hi all,
probably really simple to solve, but having no background in programming I
haven't been able to figure this out: I have two dataframes like
df1 <- data.frame(names1=c('aa','ab', 'ac', 'ad'), var1=c(1,5,7,12))
df2 <- data.frame(names2=c('aa', 'ab', 'ac', 'ad', 'ae'),
var2=c(3,6,9,12,15))
Now I want merge
2012 Mar 03
3
Shape manipulation
Hi all, let say I have following matrix:
> Dat <- matrix(1:30, 5, 6); colnames(Dat) <- rep(c("Name1", "Names2"), 3)
> Dat
Name1 Names2 Name1 Names2 Name1 Names2
[1,] 1 6 11 16 21 26
[2,] 2 7 12 17 22 27
[3,] 3 8 13 18 23 28
[4,] 4 9 14 19 24 29
[5,] 5
2011 Oct 27
2
help with paste
Hello gurus,
I have some variables, and i am creating combinations for analysis in the
end i need these variables to be displayed like "LEPTIN+SAA+PTH". currently
i am using loop to perform this. I would appreciate any pointers to do it
without the loop.
> mols=c("LEPTIN","SAA","PTH","sEGFR")
> samples=mols[1:3]
> samples
[1]
2013 Sep 05
2
binary symmetric matrix combination
Hi,
May be this helps:
m1<- as.matrix(read.table(text="
y1 g24
y1 0 1
g24 1 0
",sep="",header=TRUE))
m2<-as.matrix(read.table(text="y1 c1 c2 l17
?y1 0 1 1 1
?c1 1 0 1 1
?c2 1 1 0 1
?l17 1 1 1 0",sep="",header=TRUE))
m3<- as.matrix(read.table(text="y1 h4??? s2???? s30
?y1 0 1 1 1
?h4 1 0 1 1
?s2 1 1 0 1
?s30 1 1 1
2010 Jun 13
1
Boxplot intervals combining names
Hi R users,
This seems like a simple problem but I have searched nabble for the answer
and can't seem to find it.
All I want to do is produce a boxplot where I have two boxes for one
Individual but on the xaxis I only have one tick mark centred between the
boxes so I can add the Individuals' name. I have 30 IDs and have shown the
code I use below for a couple of IDs, I figure the data
2009 Oct 30
2
Names of list members in a plot using sapply
Hi R users:
I got this code to generate a graphic for each member of a lists.
list1<-list(A=data.frame(x=c(1,2),y=c(5,6)),B=data.frame(x=c(8,9),y=c(12,6)))
names1<-names(list1)
sapply(1:length(list1),function(i)
with(list1[[i]],plot(x,y,type="l",main=paste("Graphic of",names1[i]))))
Is there a more elegant solution for not to use two separate lists?
I would like to
2004 Jun 20
1
Fw: Evaluating strings as variables
----- Original Message -----
From: Robin Gruna
To: R-help@lists.R-project.org
Sent: Sunday, June 20, 2004 5:42 PM
Subject: Evaluating strings as variables
Hello,
I have the following problem: I have a list as follows,
> values <- list(red = 1, yellow = 2, blue = 3)
> values
$red
[1] 1
$yellow
[1] 2
$blue
[1] 3
There is also a vector containing the diffrent "colors" as
2023 Apr 03
4
Simple Stacking of Two Columns
Hi R-Helpers,
Sorry to bother you, but I have a simple task that I can't figure out how to do.
For example, I have some names in two columns
NamesWide<-data.frame(Name1=c("Tom","Dick"),Name2=c("Larry","Curly"))
and I simply want to get a single column
2023 Apr 04
1
Simple Stacking of Two Columns
Just to repeat:
you have
NamesWide<-data.frame(Name1=c("Tom","Dick"),Name2=c("Larry","Curly"))
and you want
NamesLong<-data.frame(Names=c("Tom","Dick","Larry","Curly"))
There must be something I am missing, because
NamesLong <- data.frame(Names = c(NamesWide$Name1, NamesWide$Name2))
appears to
2010 May 01
2
Average Login based on date
Hi All,
I have the data like this :
>sample <- read.csv(file="sample.csv",sep=",",header=TRUE)
> sample
stdate Domain sex age Login
1 01/11/09 xxx FeMale 25 2
2 01/11/09 xxx FeMale 35 4
3 01/11/09 xxx Male 18 30
4 01/11/09 xxx Male 31 3
5 02/11/09 xxx Male 32 11
6 02/11/09 xxx Male 31 1
7 02/11/09
2005 Dec 24
2
grouping data
Hello R-users/experts,
I am new to R-
I have a simple question:
Let say I have a data set as follows
temp:[file attached]
the data structure is a follows:
sex age
female 28
female 53
female 53
female 36
male 42
male 29
male 43
male 36
male 41
Here we are grouping all male value into male and all female value in to
female
2008 Feb 12
3
help with bwplot
Dear list,
I have following data set, which I want to plot the "Scale" variable on the
x-axis and "Mean"´on the y-axis for each Ageclass and for each sex. The Mean
value of each Ageclass for each sex would be connected by a line. Totally,
there should be 6 lines, from which three present the Mean values of each
Ageclass for respective sex. Are there any easy ways to do
2010 May 07
2
extract required data from already read data
Hi all,
I have data like this:
>sample <- read.csv(file="sample.csv",sep=",",header=TRUE)
> sample
stdate Domain sex age Login
1 01/11/09 xxx FeMale 25 2
2 01/11/09 xxx FeMale 35 4
3 01/11/09 xxx Male 18 30
4 01/11/09 xxx Male 31 3
5 02/11/09 xxx Male 32 11
6 02/11/09 xxx Male 31 1
7 02/11/09
2008 Nov 17
5
how to calculate another vector based on the data from a combination of two factors
Hi,
I have a data set similar to the following
State Gender Quantity
TX Male 1
NY Female 2
TX Male 3
NY Female 4
I need to calculate cumulative sum of the quantity by State and Gender. The
expected output is
State Gender Quantity CumQuantity
TX Male 1 1
TX Male 3 4
NY Female 2 2
NY Female 4 6
I highly appreciate if someone can give me some hints on solving that in R.
Hao
--
View this
2009 Mar 17
2
converting null to some values
Hi,
I have newbie question. Suppose I have the following data:
temp <- data.frame(type1 = c("male", "female", "male", "female", "female"),
type2 = c("low", "med", "high", "low", "med"), a = c(1,2,4, NA, 3), b =
.... [TRUNCATED]
temp
type1 type2 a b c
1 male low 1 5 0
2 female
2013 Apr 18
6
count each answer category in each column
Hey,
Is it possible that R can calculate each options under each column and
return a summary table?
Suppose I have a table like this:
Gender Age Rate
Female 0-10 Good
Male 0-10 Good
Female 11-20 Bad
Male 11-20 Bad
Male >20 N/A
I want to have a summary table including the information that how many
answers in each category, sth like this:
X
2011 Jan 23
2
Creating subsets of a matrix
Hello,
Say I have 2 columns, bmi and gender, the first being all the values and the
second being male or female. How would I subset this into males only and
females only? I have searched these fora and read endlessly about select[]
and split() functions but to no avail. Also the table is not ordered.
bmi gender -> bmi gender + bmi gender
1 24.78 male
2005 Jun 25
1
Confidence interval bars on Lattice barchart with groups
I am trying to add confidence (error) bars to lattice barcharts (and
dotplots, and xyplots). I found this helpful message from Deepayan
Sarkar and based teh code below on it:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/50299.html
However, I can't get it to work with groups, as illustrated. I am sure I
am missing something elementary, but I am unsure what.
Using R 2.1.1 on various
2012 Sep 05
2
Recoding categorical gender variable into numeric factors
I currently have a data set in which gender is inputed as "Male" and "Female"
, and I'm trying to convert this into "1" and "0".
I found a website which reccomended using two commands:
data$scode[data$sex=="M"] <- "1"
data$scode[data$sex=="F"] <- "2"
to convert to numbers, and:
data$scode <-