[R] reading a "sparse" matrix into R

Douglas Bates bates at stat.wisc.edu
Wed Apr 28 15:43:32 CEST 2004

David Meyer <david.meyer at wu-wien.ac.at> writes:

> Have you considered the read.matrix.csr() function in pkg. e1071? It
> uses another sparse input format, but perhaps you can easily transform
> your data in the supported one. Also, in my experience, data frames are
> not the best basis for a sparse format since they might turn out to be
> very memory consuming and slow... The sparse formats provided by the
> SparseM package are better suited for this.

The Matrix package (versions 0.8-1 and later) has a C function that does
the opposite operation, converting a symmetric sparse matrix to a

I would look at the way that the graph is stored there (the
formulation is from the Metis package of C code) and try to convert
your adjacency graph to that formulation first.

More information about the R-help mailing list