Displaying 1 result from an estimated 1 matches for "newexamplematrix".
2009 Jan 20
1
Creating a Sparse Matrix from a Sparse Vector
...,100. My
goal is to select a row out of the matrix and create a new matrix with that
row repeated 13,900 times without having to do any looping. Example:
Starting Matrix:
exampleMatrix
3 x 4 sparse Matrix of class "dgCMatrix"
[1,] 1 . . .
[2,] . 1 . 0.5
[3,] . . 1 ..
New Matrix:..
newExampleMatrix
3 x 4 sparse Matrix of class "dgCMatrix"
[1,] . 1 . 0.5
[2,] . 1 . 0.5
[3,] . 1 . 0.5
When I try the following I get a memory allocation error due to the size of
the array or vector:
newExampleMatrix<-Matrix(rep(exampleMatrix[2,],times=nrow
(exampleMatrix)),nrow=nrow(exampleMatrix)...