[R] questions about string handling

karena dr.jzhou at gmail.com
Thu Aug 5 02:55:53 CEST 2010


Hi, I have a question about the data handling. I have a dataset as following:
ID         snp1        snp2           snp3
1001     0/0           1/1            1/1
1002     2/2           3/3            1/1
1003     4/4           3/3            2/2

I want to convert the dataset to the following format:
ID        snp1         snp2           snp3
1001     00            AA             AA
1002     GG            CC            AA
1003     TT            CC            GG

thing to be done:
1) take the '/' off
2) replace the numbers with letters, 0 not change.   1=A, 2=G, 3=C, 4=T

what is the most efficient way to do it?

thanks you very much,

karena
-- 
View this message in context: http://r.789695.n4.nabble.com/questions-about-string-handling-tp2314335p2314335.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list