[R] How to read a long string of characters as a vector

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Feb 14 18:39:05 CET 2002


On Thu, 14 Feb 2002, [iso-8859-1] Sandra Romero wrote:

> Dear R users,
>
> I would really appreciate some help, I have a plain
> text file which contains info like
>
> NANATGGGGGGGCCCAGCTTGAATTCCCNTCCCCNTTCCCATCCAGGCC
>
> I would like to read it as a vector, for example,
> (N,A,N,A,T,G,G,G,G,G,G,G,C,C,C,........)
>
> I've tried commands such as read.table and scan but I
> don't get what I want.

use scan, then strsplit, or if you prefer, read.fwf

>
> Thank you in advanced.
>
> Sandra
>
> _________________________________________________________
>
> Información de Estados Unidos y América Latina, en Yahoo! Noticias.
> Visítanos en http://noticias.espanol.yahoo.com
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list