load_predictors: Load predictor variables from tiff files or the stac...

View source: R/load_predictors.R

load_predictorsR Documentation

Load predictor variables from tiff files or the stac catalogue

Description

Load predictor variables from tiff files or the stac catalogue

Usage

load_predictors(
  source = "from_cube",
  cube_args = list(stac_path = "http://io.biodiversite-quebec.ca/stac/", limit = 5000,
    collections = c("chelsa-clim"), t0 = NULL, t1 = NULL, spatial.res = 1000,
    temporal.res = "P1Y", aggregation = "mean", resampling = "near", buffer.box = NULL),
  predictors_dir = NULL,
  subset_layers = NULL,
  remove_collinear = T,
  method = "vif.cor",
  method_cor_vif = NULL,
  proj = NULL,
  bbox = NULL,
  mask = NULL,
  sample = TRUE,
  nb_points = 5000,
  cutoff_cor = 0.7,
  cutoff_vif = 3,
  export = TRUE,
  ouput_dir = NULL,
  as_list = T
)

Arguments

method,

The correlation method to be used:"vif.cor", "vif.step", "pearson", "spearman" or "kendall". "vif.cor" and "vif.step" use the Variance Inflation factor and the pearson correlation, more details here https://www.rdocumentation.org/packages/usdm/versions/1.1-18/topics/vif. If your variables are skewed or have outliers (e.g. when working with precipitation variables) you should favour the Spearman or Kendall methods.

proj,

a string , proj if raster layers has to be reprojected

mask,

a polygon to crop the raster

sample,

boolean value. If TRUE, sample a number of points equal to nb.points before evaluating collinearity

export,

boolean value. If TRUE, the list of selected variables and the correlation matrix will be saved in nonCollinearDir.

from_tif,

string, path to the folder containing the initial raster layers

subsetLayers,

a vector, containing the name of layers to select. If NULL, all layers in dir.pred selected by default.

removeCollinear,

boolean. If TRUE, an analysis of collinearity is performed.

method.cor.vif,

the correlation method to be used with "vif.cor" method. "pearson", "spearman" or "kendall".

nb.points,

a numeric value. Only used if sample.points = TRUE. The number of sampled points from the raster.

cutoff.cor,

a numeric value corresponding to the maximum threshold of linear correlation (for "vif.cor", "pearson", "spearman").

cutoff.vif,

a numeric value corresponding to the maximum threshold of VIF (only used for method "vif.step").

loadNonCollinear,

boolean, if TRUE, a list of non-collinear layers is used to subset the raster stack (loaded from nonCollinearDir)

nonCollinearDir,

string, path to the folder export or impot the list of non-collinear layers (if loadNonCollinear = T)

Value

a raster stack of variables not intercorrelated


ReseauBiodiversiteQuebec/sdm-pipeline documentation built on June 23, 2022, 9:10 p.m.