Skip to content
Back to formatted view

Raw Message

Message-ID: <20524.46012.915499.530432@stat.math.ethz.ch>
Date: 2012-08-16T08:47:56Z
From: Martin Maechler
Subject: reshape cast to a sparse matrix?
In-Reply-To: <CAP4V6z4jpSqgUkaVn661E6y-Y+ai9Dm5+BBQvsE+TOVXt09Kyg@mail.gmail.com>

>>>>> Yin Aphinyanaphongs <yinnerspace at gmail.com>
>>>>>     on Tue, 14 Aug 2012 09:13:21 -0400 writes:

    > I am using the reshape package to convert a series of
    > values into a binary matrix. The binary matrix is very
    > sparse with many zeros and I'd like to use cast to
    > generate a sparse matrix using any of the sparse matrix
    > packages of choice. Is there functionality to support this
    > use?

Well, the Matrix package (part of every R) has several
convenient ways to construct sparse matrices,
depending on their (special) structure.

We mostly advertize   sparseMatrix()   which has
a large 'Examples' section.

If you want, you can contact me offline for more help,
but you'd definitely have to provide more details, and a
selfcontained example.

Martin Maechler, ETH Zurich,
one of the two 'Matrix' authors.

    > Are there strategies or other packages that that may be
    > useful?

    > Due to memory constraints, it would be best to convert to
    > sparse matrix on the fly rather than build the full matrix
    > and then convert it.

    > Thanks for the help, Yin