[Rd] prcomp: problem with zeros? (PR#8870)

juha.heljoranta at iki.fi juha.heljoranta at iki.fi
Wed May 17 20:42:43 CEST 2006


Full_Name: Juha Heljoranta
Version: R 2.1.1 (2005-06-20)
OS: Gentoo Linux
Submission from: (NULL) (88.112.29.250)


prcomp has a bug which causes following error

    Error in svd(x, nu = 0) : infinite or missing values in 'x'

on a valid data set (no Infs, no missing values). The error is most likely
caused by the zeros in data.

My code and temporary workaround:


  m = matrix(...
  ...
  prcomp(m, center = TRUE, scale = TRUE)
  Error in svd(x, nu = 0) : infinite or missing values in 'x'


  m = matrix(...
  ...
  # ugly work around
  m = m + 1e-120 
  # too small values will not work
  # m = m + 1e-150 
  prcomp(m, center = TRUE, scale = TRUE)
  # success


The matrix in question is ~1024x13000 containing double values, thus totaling of
~103M of raw data. I can put it online if needed.



More information about the R-devel mailing list