[R] Odp: calculating mean of list components
Petr PIKAL
petr.pikal at precheza.cz
Wed Dec 15 14:38:26 CET 2010
Hi
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.
what does
str(listobject) give you?
What is result of
listobject[[1:5]]
I presume that you get something like
Error in listobject[[1:5]] : recursive indexing failed at level ...
Regards
Petr
>
> 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
>
> ______________________________________________
> 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