Michael Kirschbaum [EMAIL PROTECTED] writes:
I want to create a vector from specific matrix-elements( e.g.[1,1])
these matrices are elements of a list.
Is there any possibility to work without a loop? (e.g. with lapply?)
Sounds like you want
lapply(mlist, [, i = 1, j = 1)
where mlist is
Have you considere unlist? Also, note that a matrix is a vector with
a dim attribute, and a data.frame is actually a list with some other
attributes.
hope this helps.
spencer graves
Michael Kirschbaum wrote:
Hi.
Can anyone help me?
I want to create a vector from specific matrix-elements(
Something like this?
myvec - sapply(list.of.mat, function(x) x[i, j])
If all the matrices are of the same dimension, it might be easier to make
them into an array, and just slice through the array.
Andy
-Original Message-
From: Michael Kirschbaum [mailto:[EMAIL PROTECTED]
Sent:
Michael Kirschbaum wrote:
Hi.
Can anyone help me?
I want to create a vector from specific matrix-elements( e.g.[1,1]) these matrices are
elements of a list.
Is there any possibility to work without a loop? (e.g. with lapply?)
hope, you can help me
thank you
Michael
[[alternative HTML version
hi Emkiba, try this:
x - matrix(1:12, 4, 3)
y - matrix(x, 12, 1)
yy - y[,1]
regards,
Huan
Internet
[EMAIL PROTECTED]@stat.math.ethz.ch - 07/16/2003 03:24 PM
Sent by:[EMAIL PROTECTED]
To:r-help
cc:
Subject:[R] turning list-elements into a vector
Hi.
Can anyone help me?
I