[R-sig-Geo] how to do a principle component analysis with geo-referenced points

piero campa piero.campa at gmail.com
Mon Feb 7 19:16:41 CET 2011

Hi list,
I'm applying a PCA to a georeferences set of variables.

As in "A practical Guide to geostatistical mapping" by Hengl, I'm using the
command "prcomp" in R.
To recover the georeference of the principal components (which could have
some NA) it is suggested to use the values available in the returned x data
of the PCA as mask over a grid, which would be the numeric vector of 3103
elements in the example here below (i.e. attr(pc.obj$x, "dimnames")[[1]]).

> str(pc.obj)
$x       : num [1:3103, 1:2] -1.56 -1.56 -1.52 -1.42 -1.56 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:3103] "1" "2" "3" "4" ...
  .. ..$ : chr [1:2] "PC1" "PC2"

Everything works fine with the meuse dataset, but with my own data I could
not use the mask since the returned x data of the prcomp has weird values,
whose meaning I could not catch from the ?prcomp page:
$ : chr [1:1487] "2314165" "2314215" "2314265" "2314315" ...

The original dataset that fed the PCA has 1493 samples, hence the above
array should have values ranging from 1 to 1493, but it does not, as you can

Any clues about this?
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/how-to-do-a-principle-component-analysis-with-geo-referenced-points-tp2762765p6001222.html
Sent from the R-sig-geo mailing list archive at Nabble.com.

More information about the R-sig-Geo mailing list