select_vars_b: Find, optionally remove, highly correlated variables from a...

View source: R/1.2b.f.sel.env.R

select_vars_bR Documentation

Find, optionally remove, highly correlated variables from a list (several species) of raster brick/stack

Description

This function is a wrapper for ENMwizard::env.sel. See ?ENMwizard::env.sel for details It works with a named list of environmental variables (raster brick/stack). It creates a correlation matrix for the layers of a raster brick/stack for each species (item in the list) and returns a brick containing the least correlated variables below the cutoff value.

Usage

select_vars_b(
  env.l,
  cutoff = 0.9,
  corr.mat.l = NULL,
  sample.size = NULL,
  names.only = F,
  plot.dend = T,
  rm.old = F,
  filename = NULL
)

Arguments

env.l

List of raster brick/stack.

cutoff

A numeric value for the pair-wise absolute correlation cutoff.

corr.mat.l

List of correlation matrices from which variables will be selected. If the correlation matrix was already computed from env, you can just input here and choose other cutoff values for selecting variable layers.

sample.size

Numeric. Number of cells of each layer to be sampled and used for computing correlation. If NULL (default), all cells are used to compute correlation. between variables.

names.only

Logical. Return only the names of selected variables (T) or return the raster brick containing the least correlated variables (F).

plot.dend

Logical. Plot dendrogram of correlation distance between variables, showing cutoff limit and selected (black) and discarded (red) variables

rm.old

Logical. Remove (T) old env variables from folder?

filename

Output filename

See Also

select_vars, correlated, findCorrelation

Examples

## Not run: 
select_vars_b(occ.b.env, .9, names.only=T)
occ.b.env <- select_vars_b(occ.b.env, .9, names.only=F, rm.old=F)

## End(Not run)

HemingNM/ENMwizard documentation built on Jan. 4, 2024, 3:24 p.m.