TECTED] On Behalf Of Liaw, Andy
Sent: Tuesday, June 07, 2005 9:42 AM
To: 'Stefan Mischke'; r-help@stat.math.ethz.ch
Subject: RE: [R] transform large matrix into list
Here's one way to do it:
> M
x1 x2
y1 1 2
y2 4 5
y3 7 8
> (L <- cbind(v=c(M), x=c(col(M)), y=c(row(M)
.ch> cc:
Sent by: Subject: [R] transform
large matrix into list
M
To: r-help@stat.math.ethz.ch
Subject: [R] transform large matrix into list
Dear List
I need to transform a large matrix M with many NAs into a list L with
one row for each non missing cell. Every row should contain the cell
value in the first column, and its coordinates of the matrix in column
2
Here's one way to do it:
> M
x1 x2
y1 1 2
y2 4 5
y3 7 8
> (L <- cbind(v=c(M), x=c(col(M)), y=c(row(M
v x y
[1,] 1 1 1
[2,] 4 1 2
[3,] 7 1 3
[4,] 2 2 1
[5,] 5 2 2
[6,] 8 2 3
(The seemingly extraneous c()'s are to drop the dimensions of those
matrices.)
Are you sure your L[3, 3]
itris.htm
- Original Message -
From: "Stefan Mischke" <[EMAIL PROTECTED]>
To:
Sent: Tuesday, June 07, 2005 2:55 PM
Subject: [R] transform large matrix into list
Dear List
I need to transform a large matrix M with many NAs into a list L
with one row for each no
Ok, ok, I got it! Please don't laugh!
My question is the example from the posting guide! Which even includes
the answer.
How embarrassing...
Stefan
Am 07.06.2005 um 14:55 schrieb Stefan Mischke:
Dear List
I need to transform a large matrix M with many NAs into a list L with
one row for e
Dear List
I need to transform a large matrix M with many NAs into a list L with
one row for each non missing cell. Every row should contain the cell
value in the first column, and its coordinates of the matrix in column
2 and 3.
M:
x1 x2
y1 1 2
y2 4 5
y3