[R] Odp: calculating mean of list components
petr.pikal at precheza.cz
Wed Dec 15 14:38:26 CET 2010
r-help-bounces at r-project.org napsal dne 15.12.2010 14:22:15:
> 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)
As nobody knows exact structure of your listobject there is probably no
way to give you any reasonable answer.
str(listobject) give you?
What is result of
I presume that you get something like
Error in listobject[[1:5]] : recursive indexing failed at level ...
> 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.
> Jim Maas
> University of East Anglia
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help