the most efficient R package to storage sparse matrix
2
0
Entering edit mode
ywhzau • 0
@ywhzau-7363
Last seen 7.0 years ago
China

Hi guys,

 

I got a sparse matrix. All the elements of this matrix are either 0, 1, or 2. I only need to storage 1 and 2. Since there are so many sparse matrix storage formats, I am wondering is there any R package suitable for the storage of this kind of sparse matrix?

 

Thanks!

package sparse matrix • 3.4k views
ADD COMMENT
0
Entering edit mode
Robert Castelo ★ 3.4k
@rcastelo
Last seen 4 days ago
Barcelona/Universitat Pompeu Fabra

Hi ,

this is not a specific Bioconductor question, so it may happen that you do not get the most useful answer here. If you google for "rstats sparse matrix" the first link points to this blog entry http://www.johnmyleswhite.com/notebook/2011/10/31/using-sparse-matrices-in-r which mentions that the Matrix package might be what you are looking for. Read the corresponding documentation and in case of further questiond I guess the proper forum to ask is the R-help mailing list (see http://www.r-project.org/mail.html). Note also that the way you have formulated the question is not very clear. A sparse matrix is a matrix in which most of the elements are zero (see http://en.wikipedia.org/wiki/Sparse_matrix) and the most efficient way to store it depends also on whether the matrix is symmetric, etc. Since you mention you only need to store 2 other values different from zero, the RAW data type might be helpful in this case since it uses only one byte per value. Again, try to look up the corresponding documentation and existing knowledge base through google and ask in R-help in case you do not find anything useful.

cheers,

robert.

ADD COMMENT
0
Entering edit mode
ywhzau • 0
@ywhzau-7363
Last seen 7.0 years ago
China

Thanks!

I can't add comment. So I post an answer.

ADD COMMENT

Login before adding your answer.

Traffic: 623 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6