Learn R Programming

caretSDM (version 1.1.0.1)

add_predictors: Add predictors to sdm_area

Description

This function includes new predictors to the sdm_area object.

Usage

add_predictors(sa, pred, variables_selected = NULL, gdal = TRUE)

get_predictors(i)

Value

For add_predictors the same input sdm_area object is returned including the pred data binded to the previous grid. get_predictors retrieves the grid from the i object.

Arguments

sa

A sdm_area object.

pred

RasterStack, SpatRaster, stars or sf object with predictors data.

variables_selected

character vector with variables names in pred to be used as predictors. If NULL adds all variables.

gdal

Boolean. Force the use or not of GDAL when available. See details.

i

input_sdm or sdm_area object to retrieve data from.

Author

Luíz Fernando Esser (luizesser@gmail.com) and Reginaldo Ré. https://luizfesser.wordpress.com

Details

add_predictors returns a sdm_area object with a grid built upon the x parameter. There are two ways to make the grid and resample the variables in sdm_area: with and without gdal. As standard, if gdal is available in you machine it will be used (gdal = TRUE), otherwise sf/stars will be used.

See Also

sdm_area predictors bioc

Examples

Run this code
# Create sdm_area object:
sa <- sdm_area(parana, cell_size = 25000, crs = 6933)

# Include predictors:
sa <- add_predictors(sa, bioc)

# Retrieve predictors data:
get_predictors(sa)

Run the code above in your browser using DataLab