Re: [R] transforming one column into 2 columns

2008-02-02 Thread Dimitris Rizopoulos
hits=-2.5 tests�YES_00,FORGED_RCVD_HELO X-USF-Spam-Flag: NO try this: dat <- data.frame(Col = c("chr1:71310034", "chr14:23354088", "chr15:37759058", "chr22:18262638", "chrUn:31337214", "chr10_random:4369261", "chrUn:3545097")) vals <- strsplit(as.character(dat$Col), ":") dat$"Col_a" <-

Re: [R] transforming one column into 2 columns

2008-02-02 Thread Peter Dalgaard
Benilton Carvalho wrote: > help("strsplit") > b > Yes, but... The postprocessing gets a bit awkward. It might be easier to use sub() to get rid of the first/last bit of the string i.e. C2 <- sub("^.*:", "", Col) C1 <- sub(":.*$", "", Col) An orthogonal idea is con <- textConnection("Col") re

Re: [R] transforming one column into 2 columns

2008-02-02 Thread Benilton Carvalho
help("strsplit") b On Feb 2, 2008, at 12:43 PM, joseph wrote: Hello I have a data frame and one of its columns is as follows: Col chr1:71310034 chr14:23354088 chr15:37759058 chr22:18262638 chrUn:31337214 chr10_random:4369261 chrUn:3545097 I would like to get rid of col

[R] transforming one column into 2 columns

2008-02-02 Thread joseph
Hello I have a data frame and one of its columns is as follows: Col chr1:71310034 chr14:23354088 chr15:37759058 chr22:18262638 chrUn:31337214 chr10_random:4369261 chrUn:3545097 I would like to get rid of colon (:) and replace this column with two new columns containing th