[R] calculating mean of list components

Jim Maas jimmaasuk at gmail.com
Wed Dec 15 14:22:15 CET 2010


I get a list object from an iterative function.  I'm trying to figure 
out the most efficient way to calculate the mean of one element, across 
all components of the overall list.

I've tried

output <- mean (listobject[[1:5]]$element)

to get the mean of "element" in the first five components?

It doesn't like the $.  I'm suspect one of the "apply" functions will 
work, but again I've not had success


Thanks a bunch.

J

----
Jim Maas
University of East Anglia



More information about the R-help mailing list