[R] how to make read in a vector of 0s and 1s with no space between them

Matthew Keller mckellercran at gmail.com
Sun Apr 25 19:00:37 CEST 2010


Hi all,

Quickly received an answer off the list. To do this is easy. Pull it
in using e.g., scan(). Then use strsplit:

z <- '10001011010010'
strsplit(z,'')

On Sun, Apr 25, 2010 at 10:52 AM, Matthew Keller <mckellercran at gmail.com> wrote:
> Hi all,
>
> Probably a rudimentary question. I have a flat file that looks like
> this (the real one has ~10e6 elements):
>
> 10110100101001011101011
>
> and I want to pull that into R as a vector, but with each digit being
> it's own element. There are no separators between the digits. How can
> I accomplish this? Thanks in advance!
>
> Matt
>
> --
> Matthew C Keller
> Asst. Professor of Psychology
> University of Colorado at Boulder
> www.matthewckeller.com
>



-- 
Matthew C Keller
Asst. Professor of Psychology
University of Colorado at Boulder
www.matthewckeller.com



More information about the R-help mailing list