I have a data frame which is like this(4 rows and 5 column):
Marker ind1 ind2 ind3 ind4
mark1 CT TT CT TT
mark2 AG AA AG AA
mark3 AC AA AC AA
mark4 CT TT CT TT
what I want to do is to split each of the columns (except first coloumn) to two column. so the output should be like this (4 rows and 9 column):
Marker ind1 ind1 ind2 ind2 ind3 ind3 ind4 ind4
mark1 C T T T C T T T
mark2 A G A A A G A A
mark3 A C A A A C A A
mark4 C T T T C T T T
I know how to split one column
do.call(rbind,strsplit(test$JRP4RA6119.039, ""))
which gives this:
[,1] [,2]
[1,] "C" "T"
[2,] "A" "G"
[3,] "A" "C"
[4,] "C" "T"
what I would like is to be able to loop this and make it for all columns in one dataframe.
Thanks in advance.