[Rd] prcomp: problem with zeros? (PR#8870)
ripley at stats.ox.ac.uk
ripley at stats.ox.ac.uk
Wed May 17 21:02:40 CEST 2006
On Wed, 17 May 2006, juha.heljoranta at iki.fi wrote:
> Full_Name: Juha Heljoranta
> Version: R 2.1.1 (2005-06-20)
Not a current version of R.
> 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.
Why do you say that? Without a reproducible example, we cannot judge what
is going on. If you called prcomp with scale=TRUE on a matrix that has a
completely zero (or constant) column, then this is a reasonable error
message.
> 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.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list