[R] Selecting variables from a list of data.frames

Magnus account at zulutime.net
Tue Jan 6 14:00:41 CET 2009


I have a simulation program that generates a data frame for each run. I 
aggregate the data.frames into a list (df.list).  The structure of all data 
frames is the same, only the values are different.

I then want to aggregate the various runs. Currently I use the following 
method (for three runs):

means = (df.list[[1]]$variable + df.list[[2]]$variable + 
df.list[[3]]$variable)/3

I would like to do this in a more parsimonious way, for example using lapply 
or related commands, but I can't seem to figure out the magic touch. Any 
thoughts on the best way to accomplish this?

Thanks and regards,
Magnus




More information about the R-help mailing list