tags:

views:

123

answers:

1

I am using R. I want to run prcomp on a matrix. The code works fine with one installation of R on a Linux box but breaks on another identical (or so I thought) installation of R on a different Linux box. The codes are

dataf = read.table("~/data/testdata.txt")
pca = prcomp(dataf)

The error msg on the bad instance is

> dataf = read.table("~/data/testdata.txt")
> pca = prcomp(dataf)
Error in La.svd(x, nu, nv) :
  BLAS/LAPACK routine 'DGESDD' gave error code -12

Both instances of R has R version 2.9.2 (2009-08-24) and, as far as I can tell, all the R libraries and environmental variables are configured in identical ways as well.

So does anyone have suggestions on what might be wrong? What does that error code mean? (I searched internet and found nothing helpful...) Thanks a lot in advance!

+1  A: 

Your second box may have a broken Blas / Lapack installation. Unfortunately we cannot tell as you problem is not reproducible.

Here is another simple call to Blas / Lapack -- does this work for you?

R> crossprod(matrix(1:4, ncol=2))
     [,1] [,2]
[1,]    5   11
[2,]   11   25
R> 
Dirk Eddelbuettel
Yes, that example works. And in fact, the code works for some datasets but not others. Is there a way for me to share a sample `testdata.txt` file?
Zhang18
Also, Dirk, is there a way for me to re-install the Blas/Lapack independent from re-installing R? Thx.
Zhang18
Hi Zhang, re your first question: If the crossprod works, maybe your blas are not broken. Hard to tell. Re your second question: You haven't told us much, but on the systems I know (Debian, Ubuntu) the blas and lapack packages are independent of R and can be reinstalled independently. Maybe you could tell us more about your system, the versions, ....
Dirk Eddelbuettel
I was able to fix this issue by re-installation of the BLAS/LAPACK libraries. Thx.
Zhang18