PCAs4clust: PCAs4clust

View source: R/07_08_PCAs.R

PCAs4clustR Documentation

PCAs4clust

Description

PCAs4clust runs a two-steps process to prepare the data to be clustered

Usage

PCAs4clust(obj2process = NULL, cumul_var_threshold = 0.9, filename = "", ...)

Arguments

obj2process

SpatRaster object (or its file name). Each layer is one variable

cumul_var_threshold

Numeric. Optional (default = 0.9). Threshold of cumulative variance to select the number of useful PCs

filename

Character. Output filename. Optional

...

Optional. Arguments for prcomp

Details

Firstly, a Principal Component Analysis ('screening PCA') with all the variables in 'obj2process' is run in order to know the optimal number of variables to be used in a subsequent PCA, as well as the most associated variable to those Principal Components (PCs). A threshold of cumulative variance (cumul_var_threshold; default = 0.9) is needed. Secondly, a 'final PCA' is run with the results of the 'screening PCA' (i.e. number of PC axes and their most associated variables). PCAs4clust uses prcomp to run PCAs

Value

SpatRaster object

Author(s)

Xavier Rotllan-Puig

See Also

rm_multicol; prcomp

Examples


dirctry <- paste0(system.file(package='LPDynR'), "/extdata")
variables_noCor <- rm_multicol(dir2process = dirctry,
                               multicol_cutoff = 0.7)
PCAs4clust(obj2process = variables_noCor,
            cumul_var_threshold = 0.9)



LPDynR documentation built on Oct. 16, 2023, 5:06 p.m.