Skip to contents

Function to download and attach items from the chronosphere archives

Usage

fetch(
  src = NULL,
  ser = NULL,
  ver = NULL,
  res = NULL,
  ext = NULL,
  class = NULL,
  item = NULL,
  datadir = NULL,
  verbose = TRUE,
  call = FALSE,
  call.expr = FALSE,
  attach = TRUE,
  ...
)

Arguments

src

(character) The source of the series.

ser

(character) The series to get.

ver

(character) The version of the product to download. Defaults to NULL, which will download the latest available version.

res

(character or numeric) The resolution string of the data.

ext

(character) File extension of the used data file.

class

(character) Class of the returned object, if not the default.

item

(numeric) The item ID that is to be downloaded. This setting overrides all other identifiers.

datadir

(character) Directory where downloaded files are kept. Individual items 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)?

attach

(logical) If the item has required packages, should these be attached?

...

Arguments passed to item-specific loading functions.

Value

An object from a class that matches the 'class' coordinate of the item.

Details

Use the function datasets to find available series.

Examples

# An actual download call
# a <- fetch(src="paleomap", ser="dem")
# A locally-present object, in package's directory
a <- fetch(src="SOM-zaffos-fragmentation",
  datadir=system.file("extdata", package="chronosphere"))
#> 
#> ------------------------------------------------------------
#> Accessing chronosphere registry tables.
#> ------------------------------------------------------------
#> Found downloaded registry tables.
#> 
#> ------------------------------------------------------------
#> Item no. 23, src:SOM-zaffos-fragmentation, ser: fragment, ver: 20170424, res: 1my.
#> ------------------------------------------------------------
#> 
#> ------------------------------------------------------------
#> Loading downloaded import code.
#> ------------------------------------------------------------
#> 
#> ------------------------------------------------------------
#> Loading downloaded data file.
#> ------------------------------------------------------------
#> 
#> If you use the data in publications, please cite its
#> reference(s), as well as that of the 'chronosphere' project.
#> Zaffos, A., Finnegan, S., & Peters, S. E. (2017). Plate tectonic regulation of global marine animal diversity. Proceedings of the National Academy of Sciences, 114(22), Article 22. https://doi.org/10.1073/pnas.1702297114
# call repetition
fetch(a, call=TRUE)
#> fetch(src="SOM-zaffos-fragmentation", ser="fragment", ver="20170424", res="1my", verbose=FALSE)