On Wed, Dec 15, 2010 at 2:22 PM, Jim Maas wrote:
> 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)
>
>
Try this:
mean(unlist(sapply(listobject[1:5], '[', 'element')))
On Wed, Dec 15, 2010 at 11:22 AM, Jim Maas wrote:
> 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 lis
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?
I
3 matches
Mail list logo