dim_reduce | R Documentation |
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.
dim_reduce(
img_stack = NULL,
threshold = 0.5,
preferred_vars = NULL,
samples = NULL
)
img_stack |
( |
threshold |
( |
preferred_vars |
( |
samples |
( |
(ReducedImageStack
) A list of
threshold (numeric
) The threshold set in function inputs
img_reduced (stars
) The image stack after dimension reduction
cors_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.
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'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.