pcs: Retrieve a principal components model from a PCA GRaster

View source: R/princomp.r

pcsR Documentation

Retrieve a principal components model from a PCA GRaster

Description

Retrieve a principal components model from a PCA GRaster

Usage

pcs(x)

Arguments

x

A GRaster created by princomp()

Value

An object of class prcomp.

See Also

princomp(), terra::princomp(), module i.pca in GRASS

Examples

if (grassStarted()) {

# Setup
library(terra)

# Climate raster:
madChelsa <- fastData("madChelsa")

# Convert a SpatRaster to a GRaster:
chelsa <- fast(madChelsa)

# Generate raster with layers representing principal component predictions:
pcRast <- princomp(chelsa, scale = TRUE)
plot(pcRast)

# Get information on the PCA:
prinComp <- pcs(pcRast)

prinComp
summary(prinComp)
plot(prinComp)

}

adamlilith/fasterRaster documentation built on Dec. 21, 2024, 2:04 a.m.