Re: [R] splitting sample names

2011-08-19 Thread 1Rnwb
Thanks to all of you for the suggestions and corrections. Sharad -- View this message in context: http://r.789695.n4.nabble.com/splitting-sample-names-tp3753712p3755297.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.o

Re: [R] splitting sample names

2011-08-18 Thread Henrique Dallazuanna
Try this: transform(xx, Time = gsub(".*_", "", xx$Sample)) On Thu, Aug 18, 2011 at 6:43 PM, 1Rnwb wrote: > I have a data frame like this > xx<-data.frame(cbind(Sample=c('Ctrl_6h','1+0_6h','1+200_6h','1+5k_6h','Ctrl_5K_6h','ConA_6h'), >                 IFIT1=c(24,25,24.7,24.5,24.2,24.8))) > > gre

Re: [R] splitting sample names

2011-08-18 Thread Jorge I Velez
Sorry for the noise. The code should have been sapply(with(xx, strsplit(as.character(Sample), "_")), "[", 2) instead of what I sent previously. HTH, Jorge On Aug 18, 2011, at 7:30 PM, Jorge I Velez wrote: > Hi Sharad, > > Try > > xx$newSample <- sapply(with(xx, strsplit(as.character(Sampl

Re: [R] splitting sample names

2011-08-18 Thread Jorge I Velez
Hi Sharad, Try xx$newSample <- sapply(with(xx, strsplit(as.character(Sample), "_")), "[", 1) xx HTH, Jorge On Aug 18, 2011, at 5:43 PM, 1Rnwb wrote: > I have a data frame like this > xx<-data.frame(cbind(Sample=c('Ctrl_6h','1+0_6h','1+200_6h','1+5k_6h','Ctrl_5K_6h','ConA_6h'), >

Re: [R] splitting sample names

2011-08-18 Thread David Winsemius
On Aug 18, 2011, at 5:43 PM, 1Rnwb wrote: I have a data frame like this xx<- data .frame (cbind (Sample =c('Ctrl_6h','1+0_6h','1+200_6h','1+5k_6h','Ctrl_5K_6h','ConA_6h'), IFIT1=c(24,25,24.7,24.5,24.2,24.8))) grep('[[:digit:]]h',xx$Sample) yy<-xx$Sample strsplit(yy,"_")

[R] splitting sample names

2011-08-18 Thread 1Rnwb
I have a data frame like this xx<-data.frame(cbind(Sample=c('Ctrl_6h','1+0_6h','1+200_6h','1+5k_6h','Ctrl_5K_6h','ConA_6h'), IFIT1=c(24,25,24.7,24.5,24.2,24.8))) grep('[[:digit:]]h',xx$Sample) yy<-xx$Sample strsplit(yy,"_") I have to extract the time information separated by '_