[R] How to mean, min lists and numbers

guox at ucalgary.ca guox at ucalgary.ca
Mon Jul 12 17:10:40 CEST 2010


I would like to sum/mean/min a list of lists and numbers to return the
related lists.

-1+2*c(1,1,0)+2+c(-1,10,-1) returns c(2,13,0) but
sum(1,2*c(1,1,0),2,c(-1,10,-1)) returns 15 not a list.
Using the suggestions of Gabor Grothendieck,
Reduce('+',list(-1,2*c(1,1,0),2,c(-1,10,-1))) returns what we want, 
c(2,13,0).

However, it seems that this way does not work to mean/min.
So, how to mean/min a list of lists and numbers to return a list? Thanks,

-james



More information about the R-help mailing list