View source: R/06_rm_multicol.R
rm_multicol | R Documentation |
rm_multicol calculates the average of each variable and removes those variables highly correlated
rm_multicol(
dir2process = NULL,
yrs2use = NULL,
multicol_cutoff = 0.7,
cores2use = 1,
filename = "",
...
)
dir2process |
Character. Directory where the SpatRaster objects are stored. All the .tif files in the directory will be read in to be used |
yrs2use |
Numeric. A numeric vector with the years (layers positions) of the time series to be used (e.g. yrs2use = 2:21). Optional. Default (= NULL) uses all years |
multicol_cutoff |
Numeric. Cutoff value of (Pearson's) correlation. Optional. Default is 0.70 |
cores2use |
Numeric. Number of cores to use for parallelization. Optional. Default is 1 (no parallelization) |
filename |
Character. Output filename. Optional |
... |
Optional. Arguments for removeCollinearity() |
Firstly, after reading in all .tif files in 'dir2process', if they are multiband (time series), averages are
calculated. Secondly, it creates a SpatRaster object with those (averaged) variables which have a Pearson's
correlation coefficient below 'multicol_cutoff'. See removeCollinearity
for further arguments
and functionalities
SpatRaster object
Xavier Rotllan-Puig
Leroy B, Meynard CN, Bellard C, Courchamp F (2015). “virtualspecies, an R package to generate virtual species distributions”. Ecography. doi: 10.1111/ecog.01388
removeCollinearity
dirctry <- paste0(system.file(package='LPDynR'), "/extdata") # directory with variables to process
rm_multicol(dir2process = dirctry,
multicol_cutoff = 0.7,
plot = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.