[R] Package versions (was Reshape a sparse matrix)
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed May 16 10:52:09 CEST 2007
On Tue, 15 May 2007, Scott Hyde wrote:
> Thanks for the respons, Martin. The program I wrote works as well for
> doing the reshaping, but it is nice to have it built in.
> Is there a way to tell what version of Matrix is installed, and how do
> we know when new releases are issued? I installed Matrix fairly
> recently, and thought I was up to date.
library(help=Matrix) shows you the version.
If you want it programmatically, one way is
packageDescription("Matrix" , fields="Version")
update.packages() offers you updates.
(It is possible that the mirror you use has not got 0.99875-1 yet,
especially if this is a binary install, e.g, Windows or MacOS X. E.g. the
Windows binary was only built yesterday afternoon.)
> ---- Original message ----
>> Date: Wed, 16 May 2007 09:32:44 +0200
>> From: Martin Maechler <maechler at stat.math.ethz.ch>
>> Subject: Re: [R] Reshape a sparse matrix
>> To: Scott Hyde <hydes at byuh.edu>
>> Cc: r-help at stat.math.ethz.ch
>>>>>>> "Scott" == Scott Hyde <hydes at byuh.edu>
>>>>>>> on Tue, 15 May 2007 17:03:13 -1000 (HST) writes:
>> Scott> Hi,
>> Scott> I'd like to reshape a sparse matrix generated from the Matrix package. I can't seem to do it with the command
>> Scott> dim(A) <- c(6,9)
>> Scott> which works perfectly with the base package matrices, but with the sparse matrices it errors with
>> Scott> Error in dim(A) = c(6, 9) : dim<- : invalid first argument
>> This *does* work in the current version of Matrix (0.99875-1), actually
>> already in version 0.99875-0 .
>> In the next version of Matrix, it will not only work, but also
>> work "sparsely" internally via the new class "sparseVector" and
>> its daughter classes, on which I've been working during the last
>> 10 days or so...
>> Interesting that you bring the topic up right now ...
>> Scott> Manipulating the Dim attribute of the sparse Matrix does not produce the desired effect. A at Dim <- c(as.integer(9),as.integer(6)) does not produce a column ordering result, which I am assuming is because the data is stored in a row (i) and column (j) format instead (class dgTMatrix)
>> You should not have manipulate slots of S4 classes in general.
>> Some people say that you should not even access them directly.
>> Scott> Does a function for this exist?
>> yes, as I said above dim(.) <- .. works in the newest versions
>> of "Matrix".
>> Martin Maechler, ETH Zurich
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help