[R] read data into list of matrix

Greg Snow Greg.Snow at imail.org
Mon Apr 14 23:15:53 CEST 2008

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.

More information about the R-help mailing list