Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fetch

Data fetching


Description

Function to download and attach variables in the chronosphere package

Usage

fetch(
  dat,
  var = NULL,
  ver = NULL,
  res = NULL,
  datadir = NULL,
  verbose = TRUE,
  call = FALSE,
  call.expr = FALSE,
  ...
)

Arguments

dat

(character) The dataset to get variables from.

var

(character) Vector of variable names to get.

ver

(character) The version of the variable. Defaults to NULL, which will download the latest available version. We have to create a data table, which should be part of the package. This has to be searched for valid argument combinations. Right this is just a folder with a date.

res

(character or numeric) The resolution of raster layers. This has to be the same for all RasterLayers that make up the variable.

datadir

(character) Directory where downloaded files are kept. Individual layers will be looked up from the directory if this is given, and will be downloaded if they are not found. The default NULL option will download data to a temporary directory that exists only until the R session ends.

verbose

(logical) Should console feedback during download be displayed?

call

(logical) If set to TRUE the function call is returned instead of the object.

call.expr

(logical) If call is set to TRUE, then should the call be returned as an expression (TRUE) or a message (FALSE)?

...

Arguments passed to variable-specific loading functions.

Details

Use the function datasets to find available variables.

Value

An object that matches the 'type' field of the varibles in the output of the datasets function.

Examples

# An actual download call
# a <- fetch(dat="paleomap", var="dem")
# call repetition
fetch(dat="paleomap", var="dem", call=TRUE)
# A locally-present object, in package's directory
a <- fetch(dat="paleomap", var="model", 
  datadir=system.file("extdata", package="chronosphere"))

chronosphere

Earth System History Variables

v0.4.1
CC BY 4.0
Authors
Adam T. Kocsis, Nussaibah B. Raja
Initial release
2021-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.