Fabulous!
I'll start with trying out Reduce, and then explore do.call or converting it to
an array if I need to.
Thank you Dimitris, Baptiste, and Josh for the very quick help!
Best,
Tim
>>> Dimitris Rizopoulos 11/24/2010 2:43 PM >>>
try this:
DF.lis <- list(
one = data.frame(x = c(1,
Hi Tim,
It may not be possible, but if you can use an array, it is super easy:
## convert to array
Sue <- array(unlist(x), dim = c(3, 3, 2))
## use apply() on first two dimensions (collapse across 3rd)
apply(X = Sue, MARGIN = c(1, 2), FUN = mean)
Cheers,
Josh
On Wed, Nov 24, 2010 at 11:37 AM,
try this:
DF.lis <- list(
one = data.frame(x = c(1,2,3), y = c(1,2,2), z = c(3,1,1)),
two = data.frame(x = c(2,5,2), y = c(2,3,1), z = c(4,1,2))
)
Reduce("+", DF.lis) / length(DF.lis)
I hope it helps.
Best,
Dimitris
On 11/24/2010 8:37 PM, Tim Howard wrote:
R users,
This probably in
Hi,
Try this,
do.call(`+`, x) / length(x)
HTH,
baptiste
On 24 November 2010 20:37, Tim Howard wrote:
> R users,
> This probably involves a simple incantation of one of the flavors of apply...
> that I can't yet figure out. Consider a list of data frames. I'd like to
> apply a function (mean
4 matches
Mail list logo