Re: [R] spliting

From: jim holtman <jholtman_at_gmail.com>
Date: Fri 28 Jul 2006 - 21:22:38 EST

> x

  V1 V2 V3
1 GG AG AG
2 CC CC CC
3 CC CC CC
4 AG AG AG
5 GG GG GG
6 TT TT CT
> t(apply(x,1,function(z)do.call('cbind',strsplit(z,''))))
  [,1] [,2] [,3] [,4] [,5] [,6]

1 "G"  "G"  "A"  "G"  "A"  "G"
2 "C"  "C"  "C"  "C"  "C"  "C"
3 "C"  "C"  "C"  "C"  "C"  "C"
4 "A"  "G"  "A"  "G"  "A"  "G"
5 "G"  "G"  "G"  "G"  "G"  "G"
6 "T"  "T"  "T"  "T"  "C"  "T"

>

On 7/28/06, yohannes alazar <hannesalazar@gmail.com> wrote:
>
> Dear mailing list,
>
> I have a big data frame and each element in the matrix has two alphabets.
> I
> want to split those alphabets into two so each element will have one
> alphabet and the number of my columns will be doubled . So can some one
> help
> with the code?
> Example of what I want is to split them.
>
>
> Input (three column)
>
> GG AG AG
>
> CC CC CC
>
> CC CC CC
>
> AG AG AG
>
> GG GG GG
> TT TT CT
>
>
> Output (six column)
>
> G G A G A G
>
> C C C C C C
>
> C C C C C C
>
> A G A G A G
>
> G G G G G G
> T T T T C T
>
> thank you
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch 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.
Received on Fri Jul 28 21:27:08 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 28 Jul 2006 - 22:17:26 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.