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" <- sapply(vals, "[", 1)
dat$"Col_b" <- as.numeric(sapply(vals, "[", 2))
dat


I hope it helps.

Best,
Dimitris


----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


Quoting joseph <[EMAIL PROTECTED]>:



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 the terms on each side of the colon. The new columns
should look as follows:




Col_a   Col_b


chr1     71310034


chr14   23354088


chr15   37759058


chr22   18262638


chrUn   31337214


chr10_random  4369261


chrUn   3545097





Any help will be much appreciated


Joseph






____________________________________________________________________________________
Looking for last minute shopping deals?

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.





Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to