Hi, I need to read a string vector in R which is like this "atgctaaaactaatcgtcccaacaattatattactaccac", but R seems to understand it as a unique vector input when I read in like x <- "atgctaaaactaatcgtcccaacaattatattactaccac". How do I unconcatenate it, so I can use each of the letters on my reading? Thanks, Beatriz -- View this message in context: http://n4.nabble.com/reading-a-string-vector-tp1290289p1290289.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]
On 01/26/2010 02:08 PM, bia.estat wrote:> Hi, I need to read a string vector in R which is like this > "atgctaaaactaatcgtcccaacaattatattactaccac", but R seems to understand it as > a unique vector input when I read in like x<- > "atgctaaaactaatcgtcccaacaattatattactaccac". How do I unconcatenate it, so I > can use each of the letters on my reading? > > Thanks, > BeatrizSee ?strsplit > strsplit( x, "")[[1]] Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/KfKn : Rcpp 0.7.2 |- http://tr.im/JOlc : External pointers with Rcpp `- http://tr.im/JFqa : R Journal, Volume 1/2, December 2009
Like this?
strsplit("atgctaaaactaatcgtcccaacaattatattactaccac",
split="")
-Ista
On Tue, Jan 26, 2010 at 8:08 AM, bia.estat <bia.cdc at live.com>
wrote:>
> Hi, I need to read a string vector in R which is like this
> "atgctaaaactaatcgtcccaacaattatattactaccac", but R seems to
understand it as
> a unique vector input when I read in like x <-
> "atgctaaaactaatcgtcccaacaattatattactaccac". How do I
unconcatenate it, so I
> can use each of the letters on my reading?
>
> Thanks,
> Beatriz
> --
> View this message in context:
http://n4.nabble.com/reading-a-string-vector-tp1290289p1290289.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org
Try this:
strsplit("atgctaaaactaatcgtcccaacaattatattactaccac", NULL)
On Tue, Jan 26, 2010 at 11:08 AM, bia.estat <bia.cdc at live.com>
wrote:>
> Hi, I need to read a string vector in R which is like this
> "atgctaaaactaatcgtcccaacaattatattactaccac", but R seems to
understand it as
> a unique vector input when I read in like x <-
> "atgctaaaactaatcgtcccaacaattatattactaccac". How do I
unconcatenate it, so I
> can use each of the letters on my reading?
>
> Thanks,
> Beatriz
> --
> View this message in context:
http://n4.nabble.com/reading-a-string-vector-tp1290289p1290289.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
--
Henrique Dallazuanna
Curitiba-Paran?-Brasil
25? 25' 40" S 49? 16' 22" O