error with princomp
On Sun, 21 May 2000, Bill Venables wrote:
At 01:08 PM 5/20/00 -0400, Faheem Mitha wrote:
I now have another question. I am trying to use princomp with a data frame
of size (2061,98) so quite large. I successfully applied princomp in Splus
to it, but the R version exits with the following incomprehensible error:
Error in if (symmetric) { : missing value where logical needed
if (symmetric) does not appear in the code for princomp so I am flummoxed.
Did traceback() say it came from princomp?
No.
traceback()
[1] "eigen(cv)" "princomp(prin.df, cor = T)"
princomp
Did you use traceback() at all?
Not till Douglas Bates mentioned it.
Do you know about traceback()?
Used it in Splus, but Splus helpfully reminds you about it. Never realised it was in R, never thought of using it. I will from now on, though. I really would like to learn this stuff.
Don't worry if the answer to all three questions is a shrug - many users are like that, but it really is a fundamental tool for errors like this and I recommend it to all.
traceback() would have told you that the error is not in princomp() but in eigen(), the workhorse that princomp() uses. That has to be a clue. Have you looked at the code for eigen()?
Yup. I'm guessing the relevant part is
if (symmetric) {
if (complex.x) {
xr <- Re(x)
xi <- Im(x)
z <- .Fortran("ch", n, n, xr, xi, values = dbl.n,
!only.values, vectors = xr, ivectors = xi, dbl.n,
dbl.n, double(2 * n), ierr = integer(1), PACKAGE = "base")
if (z$ierr)
stop(paste("ch returned code ", z$ierr, " in eigen"))
if (!only.values)
z$vectors <- matrix(complex(re = z$vectors, im =
z$ivectors),
nc = n)
}
But this does not enlighten me. It seems to involve a call to some Fortran
code, and I don't know Fortran. And I am still freaked that it worked in
Splus and not in R (same data set, same code).
Could someone speculate on possible reasons? I have given up hope of
running this successfully on R (even if I figure out what it wrong,
princomp for a data set this large requires an unholy amount of memory,
probably more than I have available) but I am curious what it causing it
to go kerblooey. I tried princomp with small data sets and it works fine.
Faheem.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._