Re: [R] Creating a sparse matrix from a file

2009-10-28 Thread Pallavi P
Hi Martin, Unfortunately, the error is coming on the data set that I have right now. I was successfully able to display any field in the matrix and even the whole matrix when I tried the example code provided by you. However, it is failing on the dataset I am working on.I can share the file with y

Re: [R] Creating a sparse matrix from a file

2009-10-28 Thread Martin Maechler
> "PP" == Pallavi P > on Wed, 28 Oct 2009 16:30:25 +0530 writes: PP> Hi Martin, PP> I followed your example on my set of data. Which has non zero values in PP> 300k positions in 22638 X 80914 sparse matrix. I am able to load data into a PP> field and was able to do s

Re: [R] Creating a sparse matrix from a file

2009-10-28 Thread Pallavi P
Hi Martin, I followed your example on my set of data. Which has non zero values in 300k positions in 22638 X 80914 sparse matrix. I am able to load data into a field and was able to do some operations (essentially t(m) %*% m). However, when I tried to display the value in the resulted matrix. I

Re: [R] Creating a sparse matrix from a file

2009-10-27 Thread Martin Maechler
> "PP" == Pallavi P > on Tue, 27 Oct 2009 18:13:22 +0530 writes: PP> Hi Martin, PP> Thanks for the help. Just to make sure I understand correctly. PP> The below steps are for creating an example table similar to the one that I PP> read from file. yes, exactly

Re: [R] Creating a sparse matrix from a file

2009-10-27 Thread Pallavi P
Hi Martin, Thanks for the help. Just to make sure I understand correctly. The below steps are for creating an example table similar to the one that I read from file. n <- 22638 m <- 80914 nnz <- 30 # no idea if this is realistic for you set.seed(101) ex <- cbind(i = sample(n,nnz, replace=TR

Re: [R] Creating a sparse matrix from a file

2009-10-27 Thread Martin Maechler
PP> Hi all, PP> I used sparseM package for creating sparse Matrix and PP> followed below commands. I'd strongly recommend to use package 'Matrix' which is part of every R distribution (since R 2.9.0). PP> The sequence of commands are: >> ex <- read.table('fileName',sep=','

Re: [R] Creating a sparse matrix from a file

2009-10-27 Thread Pallavi Palleti
Hi all, I used sparseM package for creating sparse Matrix and followed below commands. The sequence of commands are: >ex <- read.table('fileName',sep=',') > M <- as.matrix.csr(0,22638,80914) >for (i in 1:nrow(ex)) { M[ex[i,1],ex[i,2]]<-ex[i,3]} Even after 4 hours, I can still see the above co

Re: [R] Creating a sparse matrix from a file

2009-10-26 Thread Pallavi Palleti
Hi David, Thanks for your help. This is exactly what I want. But, I have number of rows of my matrix = 25k and columns size as 80k. So, when I define a matrix object, it is throwing an error saying can not allocate a vector of length (25K * 80k). I heard that, this data can still be loaded into R

Re: [R] Creating a sparse matrix from a file

2009-10-26 Thread David Winsemius
On Oct 26, 2009, at 5:06 AM, Pallavi Palleti wrote: Hi all, I am new to R and learning the same. I would like to create a sparse matrix from an existing file whose contents are in the format "rowIndex,columnIndex,value" for ex: 1,2,14 2,4,15 I would like to create a sparse matrix by

[R] Creating a sparse matrix from a file

2009-10-26 Thread Pallavi Palleti
Hi all, I am new to R and learning the same. I would like to create a sparse matrix from an existing file whose contents are in the format "rowIndex,columnIndex,value" for ex: 1,2,14 2,4,15 I would like to create a sparse matrix by taking the above as input. However, I couldn't find an ex