Displaying 3 results from an estimated 3 matches for "mischke".
2005 Jun 07
6
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 and 3.
M:
x1 x2
y1 1 2
y2 4 5
y3 7 8
L:
v x y
1 1 1
4 1 2
7 1 2
2 2 1
5 2 2
8 2 3
I'm trying to do this with a loop, but since my matrix is quite large
(around
2005 Jun 02
3
merge large matrices
Dear List
I have two large matrices A and B. Both have the same dimensions, let's
say 20k x 30k. About half the cells of B are missing. Now I'm looking
for an efficient way to merge them, so that the missing values in B are
replaced by the corresponding values of A.
Matrix A
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 6
merged with Matrix B
[,1] [,2] [,3]
[1,] 10 NA NA
[2,] NA 50 60
2005 Jun 16
1
regressing each column of a matrix on all other columns
DeaR list
I would like to predict the values of each column of a matrix A by
regressing it on all other columns of the same matrix A. I do this with
a for loop:
A <- B <- matrix(round(runif(10*3,1,10),0),10)
A
for (i in 1:length(A[1,])) B[,i] <- as.matrix(predict(lm( A[,i] ~
A[,-i] )))
B
It works fine, but I need it to be faster. I've looked at *apply but
just can't