Learn R Programming

chronosphere (version 0.4.1)

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,
  ...
)

Value

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

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.

Examples

Run this code
# 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"))

Run the code above in your browser using DataLab