[R] assigment

Joshua Wiley jwiley.psych at gmail.com
Fri Nov 19 12:48:28 CET 2010


On Fri, Nov 19, 2010 at 3:20 AM, Robert Ruser <robert.ruser at gmail.com> wrote:
> a2 a should get the values.

Lists are a nice way to allow variable data (e.g., vectors, data
frames, matrices, etc. all of different sizes) but still group related
things (such as data from a single file) together, kind of like
putting all your vegetables on one shelf of your fridge and all your
drinks on another.  If you really just want everything tossed in the
fridge (as it were), Dennis provided an option.

> Do you know how to read file 2 into R?

Hmm, it is difficult to say precisely without the actual file, but it
sounds like you should look at:

?readLines

You may need to do some additional processing if you get the data in
with readLines   (I think it pulls everything in as character data, so
you might need to split each row and convert to numeric or integer.
See ?strsplit for one way to split data, ?as.numeric, ?as.integer for
potential conversions).  Usually for reading in data I try (in this
order because read.table() is generally much easier to use than
readLines or scan):

read.table(), readLines(), and if all else fails, scan()

HTH,

Josh

[snip]



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list