Re: [R] spare matrix replacing values efficiently

2010-08-22 Thread Charles C. Berry
On Sun, 22 Aug 2010, david h shanabrook wrote: I am working with a large sparse matrix trying replace all 1 values with 0. The normal method doesn't work. Here is a small example: x <- Matrix(0,nrow=10,ncol=10,sparse=TRUE) x[,1] <- 1:2 x 10 x 10 sparse Matrix of class "dgCMatrix" [1,] 1 .

[R] spare matrix replacing values efficiently

2010-08-22 Thread david h shanabrook
I am working with a large sparse matrix trying replace all 1 values with 0. The normal method doesn't work. Here is a small example: > x <- Matrix(0,nrow=10,ncol=10,sparse=TRUE) > x[,1] <- 1:2 > x 10 x 10 sparse Matrix of class "dgCMatrix" [1,] 1 . . . . . . . . . [2,] 2 . . . . . . . . . [3,]