Re: [R] List of data frames...

About this list Date view Thread view Subject view Author view Attachment view

From: Peter Dalgaard (p.dalgaard@biostat.ku.dk)
Date: Fri 14 May 2004 - 05:00:09 EST


Message-id: <x2u0ykb1ae.fsf@biostat.ku.dk>

Rheaume.Pascal@hydro.qc.ca writes:

> Hi,
>
> I would like to create a list of data frames that I could access via index
> manipulation. An array pointer of dataframe...
>
> for (i in 1:length(InputFilelist))
> {
> # create data.frame
> temp <- read.table (file = InputFilelist[i] , header = T, skip = 4)
> # append data.frame
> InputDataFrame <<- list(InputDataFrame,temp)
> }
>
> Thanks in advance !

You don't want to extend the list on every iteration (it involves
copying the current contents!).

Try this:

lapply(InputFilelist, read.table, header=TRUE, skip=4)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:10 EST