[R] How to add rowSums into list?

Lauri Nikkinen lauri.nikkinen at iki.fi
Fri Jan 11 14:08:40 CET 2008


Hi R-users,

I have a list

a <- list(one=matrix(rnorm(20), 5, 4), two=matrix(rnorm(20, 3, 0.5),5,4))

How to add rowSums (calculated using lapply) to corresponding matrix
in this list

lapply(a, function(x) rowSums(x))

??

-Lauri




More information about the R-help mailing list