On Sun, Sep 12, 2010 at 9:40 AM, Sebastian Gibb <li...@sebastiangibb.de> wrote: > But I want to do a "sapply" over the "values" vectors. > Try multivariate apply. For more on loops and the apply family check [1]. You might also want to check the plyr package and its documentation. Liviu [1] http://promberger.info/files/rnews-vectorvsloops2008.pdf
> mapply(mean, tree[[1]]$node$values, tree[[2]]$node$values) [1] 1 2 3 4 5 6 7 8 9 10 > mapply(mean, tree[[1]]$node$values, tree[[2]]$node$values, SIMPLIFY=F) [[1]] [1] 1 [[2]] [1] 2 [[3]] [1] 3 [[4]] [1] 4 [[5]] [1] 5 [[6]] [1] 6 [[7]] [1] 7 [[8]] [1] 8 [[9]] [1] 9 [[10]] [1] 10 > ______________________________________________ R-help@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.