How about this ("df" is your input data.frame)
data.frame(ID=df[,1], apply(df[,2:4], 2, function(x) c("00", "AA",
"GG", "CC", "TT")[match(x, c("0/0", "1/1", "2/2", "3/3", "4/4"))]))
Michael
On 5 August 2010 10:55, karena wrote:
>
> Hi, I have a question about the data handling. I have a dataset
Tena koe Karena
See ?sub and ?gsub
HTH ...
Peter Alspach
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of karena
> Sent: Thursday, 5 August 2010 12:56 p.m.
> To: r-help@r-project.org
> Subject: [R] ques
Hi, I have a question about the data handling. I have a dataset as following:
ID snp1snp2 snp3
1001 0/0 1/11/1
1002 2/2 3/31/1
1003 4/4 3/32/2
I want to convert the dataset to the following for
3 matches
Mail list logo