From juha.heljoranta at iki.fi  Wed May 17 20:42:43 2006
From: juha.heljoranta at iki.fi (juha.heljoranta at iki.fi)
Date: Wed, 17 May 2006 20:42:43 +0200 (CEST)
Subject: [Rd] prcomp: problem with zeros? (PR#8870)
Message-ID: <20060517184243.A337B1990D@slim.kubism.ku.dk>

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.



[Rd] prcomp: problem with zeros? (PR#8870)
juha.heljoranta at iki.fi