lapply(a, addmargins, 2)
On 11/01/2008, Lauri Nikkinen [EMAIL PROTECTED] wrote:
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)
januari 2008 14:09
Aan: [EMAIL PROTECTED]
Onderwerp: [R] How to add rowSums into list?
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
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
__
On 11/01/2008, Lauri Nikkinen [EMAIL PROTECTED] wrote:
Thanks, one further question: how to order these matrices using these row
sums?
lapply(a, function(x) order(x[,5])) #produces only indeces
...which you can use as row indices 'idxs' to reorder the rows of
matrix 'x' by x[idxs,].
/Henrik
Lauri Nikkinen wrote:
Thanks, one further question: how to order these matrices using these row
sums?
lapply(a, function(x) order(x[,5])) #produces only indeces
lapply(a, function(x) x[order(x[,5]),])
-Lauri
2008/1/11, Henrique Dallazuanna [EMAIL PROTECTED]:
lapply(a,
Thanks, one further question: how to order these matrices using these row sums?
lapply(a, function(x) order(x[,5])) #produces only indeces
-Lauri
2008/1/11, Henrique Dallazuanna [EMAIL PROTECTED]:
lapply(a, addmargins, 2)
On 11/01/2008, Lauri Nikkinen [EMAIL PROTECTED] wrote:
Hi R-users,
6 matches
Mail list logo