PCA with BioClim Rasters - R language

34 Views Asked by At

I am trying to run a PCA with the BioClim variable rasters in R. raster_pca() was the old function for this, so I am looking for its replacement.

I don't want to turn it into a data frame because I want to map the PCs after.

I read in the 19 variables and made a raster stack (BioClim).

I've tried:

BioClim_pca <- princomp(x = BioClim)

but I get the error:

Error: vector memory exhausted (limit reached?)

and I've tried:

BioClim_pca <- princomp(BioClim)

but I get:

Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x), : length of 'dimnames' [1] not equal to array extent

I get the same errors whether I use prcomp() or princomp()

My goal is to get raster layers of PC1, PC2, and PC3 and to be able to visualize those in a map.

0

There are 0 best solutions below