Re: [R] read data into list of matrix

From: Greg Snow <Greg.Snow_at_imail.org>
Date: Mon, 14 Apr 2008 15:15:53 -0600

Read the help page on '[', then read it again a couple more times (it can be subtle). I think you want to use fp[[1]] rather than fp[1], the first will return a single element from the list (a data frame in the case below), the second returns a list of length 1 (with that element being a data frame, but wrapped in a list).

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow_at_imail.org
(801) 408-8111
 
 


> -----Original Message-----
> From: r-help-bounces_at_r-project.org
> [mailto:r-help-bounces_at_r-project.org] On Behalf Of Jonas Stein
> Sent: Monday, April 14, 2008 3:00 PM
> To: r-help_at_stat.math.ethz.ch
> Subject: Re: [R] read data into list of matrix
>
> >> i have a list of many files and want to load them into a list of
> >> tables, that can be adressed with a variable 'i'.
>
>
> > fp <- lapply(files, read.table, header = T)
>
> Thank you that works fine.
>
> But how can i access the data in column fp$foo now?
>
> fp[1]$foo does not work.
>
> ps: thank you all for the replies per mail and the list here.
>
> --
> Jonas Stein <news_at_jonasstein.de>
>
> ______________________________________________
> 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.
>
______________________________________________ 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.
Received on Mon 14 Apr 2008 - 21:24:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 Apr 2008 - 22:30:29 GMT.

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

list of date sections of archive