I had an earlier problem where cutting and pasting from a help window
caused obscure problems. Prof Ripley suggested trying example() and
that did show that the example on the help page "worked". I just ran
example(`%x%`), as well as example(matrix.csr) and encountered no
errors. I also tried re-entering the first example on the help page
and am still getting the error. It looks as though the help page that
comes up with help(`%x%`) is similar to the second example suite. But
it's not precisely the same.
For me it's not a problem, since I'm not using SparseM at the moment.
I was just trying to help out the OP. I still should probably a)
restart an run without Matrix loaded, and b) upgrade to a more recent
R, but I have a number of models and datasets that I am working on and
those efforts take precedence.
> n1 <- 10
> n2 <- 10
> p <- 6
> y <- rnorm(n1)
> a <- rnorm(n1*p)
> a[abs(a)<0.5] <- 0
> A <- matrix(a,n1,p)
> A.csr <- as.matrix.csr(A)
> b <- rnorm(n2*p)
> b[abs(b)<1.0] <- 0
> B <- matrix(b,n2,p)
> B.csr <- as.matrix.csr(B)
>
> # matrix transposition and multiplication
> A.csr%*%t(B.csr)
elided output.... no error
>
> # kronecker product
> A.csr %x% matrix(1:4,2,2)
Error in dim(x) <- length(x) : invalid first argument
Also tried kronecker():
> kronecker(A.csr, matrix(1:36, 10,10))
Error in dim(x) <- length(x) : invalid first argument
--
David.
On Jan 11, 2010, at 10:02 AM, Roger Koenker wrote:
I can't reproduce this on my mac:
sessionInfo()
R version 2.10.1 (2009-12-14)
x86_64-apple-darwin9.8.0
locale:
[1] C
attached base packages:
[1] graphics grDevices datasets utils stats methods base
other attached packages:
[1] fortunes_1.3-7 quantreg_4.44 SparseM_0.83
loaded via a namespace (and not attached):
[1] tools_2.10.1
url: www.econ.uiuc.edu/~roger Roger Koenker
email rkoen...@uiuc.edu Department of Economics
vox: 217-333-4558 University of Illinois
fax: 217-244-6678 Urbana, IL 61801
On Jan 11, 2010, at 8:00 AM, David Winsemius wrote:
On Jan 11, 2010, at 7:55 AM, Peter Ehlers wrote:
Do you have the same problem with the example
on the help page?
?'%x%-methods'
Works for me on Windows Vista (32-bit OS) and
R version 2.10.1 Patched (2010-01-05 r50896).
-Peter Ehlers
alessia matano wrote:
Dear all,
I just installed the new version of R, 2.10.1, and I am currently
using the package sparseM. (I also use a 64 bit windows version)
SparseM
I got a problem that I never had: when I try to multiply with a
kronecker product (%x%) two sparse matrixes I get the following
message:
Error in dim(x) <- length(x) : invalid first argument
I never had this problem with previous versions of R.
I get the same error as you do when trying the example on the cited
help page using SparseM 0.83 in a 64 bit Mac version of 2.10.1
A.csr %x% matrix(1:4,2,2)
Error in dim(x) <- length(x) : invalid first argument
sessionInfo()
R version 2.10.1 RC (2009-12-09 r50695)
x86_64-apple-darwin9.8.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] grid splines stats graphics grDevices utils
datasets methods base
other attached packages:
[1] SparseM_0.83 Matrix_0.999375-32 Epi_1.1.10
plotrix_2.7-2 ROCR_1.0-4
[6] gplots_2.7.4 caTools_1.10 bitops_1.0-4.1
gdata_2.6.1 gtools_2.6.1
[11] lattice_0.17-26 Design_2.3-0 Hmisc_3.7-0
survival_2.35-7
loaded via a namespace (and not attached):
[1] cluster_1.12.1 tools_2.10.1
May you help me?
thanks
alessia
______________________________________________
--
Peter Ehlers
University of Calgary
403.202.3921
______________________________________________
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.