[R-sig-Geo] Problem with operations on large files ("cannotallocate vector of size xx")

Benjamin Leutner benjamin.leutner at uni-wuerzburg.de
Fri Feb 3 15:24:56 CET 2017


Hi,

Blockwise calculation does not make sense with PCA as you will end-up 
with different components in each block.

As I wrote earlier, to calculate the PCA  based on all pixels you should 
calculate the covariance matrix first, which can be done in a memory 
safe way (raster::layerStats) and then feed that into princomp.
see:
https://github.com/bleutner/RStoolbox/blob/master/R/rasterPCA.R

cheers,
Benjamin

On 03.02.2017 15:10, Maurizio Marchi wrote:
> Yes, Tina is right, anyway consider also that, looking at my code, the
> prcomp function and the predict functions can be run with different
> objects. For instance the pca can be run on a 5 km raster map (aggregated)
> or on the random samples (you will see that with an adequate number of
> points the results will be the same) but the predict function can be
> launched on the original dataset (1km) obtaining the pca components with
> the desired spatial resolution
>
> Regards, maurizio
>
> ​--
> Maurizio Marchi,
> PhD - Forest Science, Ecological Modelling
> Council for Agricultural Research and Economics (CREA, Italy)
> SkypeID: maurizioxyz
> https://scholar.google.it/citations?user=_2X6fu8AAAAJ&hl=en
> #-----#
> http://ec.europa.eu/environment/life/project/Projects/index.cfm?fuseaction=search.dspPage&n_proj_id=5035
> www.selpibio.eu
> ​​www.eufgis.org​
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list