[R] pca

Martin Maechler maechler at stat.math.ethz.ch
Wed Apr 30 13:56:43 CEST 2003


>>>>> "Martin" == Martin Wegmann <wegmann at biozentrum.uni-wuerzburg.de>
>>>>>     on Wed, 30 Apr 2003 11:40:40 +0200 writes:

    Martin> Hello, I tried to compute a PCA of values derived
    Martin> from satellite imagery but with princomp I get the
    Martin> following output:

    >> pca.late <- princomp(late, na.action=na.fail)
    Martin> Error in cov.wt(z) : x must contain finite values only

    Martin> the datasets are values from satellite imagery,
    Martin> therfore I assume they are finite. But if not is
    Martin> there a way to minimize the decimal place?

    Martin> I tried prccomp as well but I don't understand this
    Martin> output at all and I can't add "na.action=na.pass"
    Martin> what I thought could be the problem.

    Martin>  pcalate<-prcomp(late,scale=T) 
    Martin> Error in svd(x, nu=0) : NA/NaN/Inf in foreign function call (arg 1)

    Martin> any idea how to fix it?

As Christian has suggested, look at your data.  I'm sure there
are non-finite values.

To find these, quickly, you can use

   which(!is.finite(data.matrix(late)), arr.ind = TRUE)

which will give you the row and column numbers of the non-finite
entries.

Hoping this helps,
Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><



More information about the R-help mailing list