Learn R Programming

Mapinguari (version 2.0.1)

get_rasters: Retrieve and organize spatial rasters.

Description

get_rasters Loads rasters from directory and returns them in an organized list of specified scenarios.

Usage

get_rasters(
  var = NULL,
  scenario = NULL,
  raster_path = NULL,
  ext = c(-180, 180, -60, 90),
  coord_col = c("Lon", "Lat"),
  margin = 0,
  separator = "_"
)

Value

Returns a list of raster stacks for the variables required, organized by year/scenario combination.

Arguments

var

character. Names of variables to be loaded.

scenario

character. Names of scenarios for the variables.

raster_path

character. Path to folder with raster files. See writeFormats for supported formats

ext

numeric, data. frame or Extent object. Extent to crop rasters.

coord_col

character. Names of columns containing Longitude and Latitude.

margin

numeric. Additional distance to be added to margin of extent, in degrees.

separator

character. Character that separates variable names and scenario names.

Examples

Run this code
if (FALSE) {
# replace rasterpath with the directory on your computer containing worldclim data

Fulanus_Ecorasters_present <-
  get_rasters(
    var = c('prec', 'tmin', 'tmax'),
    scenario = 'present',
    raster_path = "C:/Users/gabri/Dropbox/Mapinguari/global_grids_10_minutes",
    ext = FulanusDistribution[c(2,3)],
    margin = 5)
}

Run the code above in your browser using DataLab