dim_reduce {itsdm} | R Documentation |
Remove environmental variables that have high correlation with others.
Description
Select environmental variables that have pairwise Pearson correlation lower than a user-defined threshold. NOTE that it only works on numeric variables, does not work on categorical variables.
Usage
dim_reduce(
img_stack = NULL,
threshold = 0.5,
preferred_vars = NULL,
samples = NULL
)
Arguments
img_stack |
( |
threshold |
( |
preferred_vars |
( |
samples |
( |
Value
(ReducedImageStack
) A list of
threshold (
numeric
) The threshold set in function inputsimg_reduced (
stars
) The image stack after dimension reductioncors_original (
data.frame
) A table of Pearson correlations between all variables.cors_reduced (
data.frame
) A table of Pearson correlations between variables after dimension reduction.
Examples
library(sf)
library(itsdm)
library(stars)
library(dplyr)
env_vars <- system.file(
'extdata/bioclim_tanzania_10min.tif',
package = 'itsdm') %>% read_stars()
img_reduced <- dim_reduce(env_vars, threshold = 0.7,
preferred_vars = c('bio1', 'bio12'))