R/cdb_fetch.R
cdb_fetch.Rd
Fetches the current version of a COM(P)ADRE database from https://compadre-db.org, or load any version stored in a local .RData file.
cdb_fetch(cdb, version = NULL, flag = FALSE, userComment = NULL, quiet = FALSE)
Either "comadre" or "compadre" (case insensitive) to fetch the most recent database from https://compadre-db.org, or a path to an existing COMPADRE database (i.e. .RData file) stored on the local machine.
Optional. The version number of a particular database to be downloaded e.g. "3.0.0". If this is not included (as default) the latest versions are downloaded.
Logical argument where `TRUE` will automatically run cdb_flag to add logical columns to the metadata to flag potential problems in the matrix population models. Default is `FALSE`.
An optional string to enable users to add a comment as an attribute to the returned data frame. This could be useful for keeping track of multiple versions of the database. Accessed by `attributes(db)$comment`.
A logical argument. If `TRUE` the download message that includes version information and link to the user agreement is suppressed. Default is `FALSE`.
A CompadreDB object
The downloaded databases include a set of attributes accessible with `attributes`. These include version information and date and time of creation.
Other data acquisition:
cdb_build_cdb()
,
cdb_metadata()
if (FALSE) {
# Download latest version of COMPADRE direct from the website
compadre <- cdb_fetch("compadre")
# Examine the attributes of the downloaded database
attributes(compadre)
# Download COMPADRE version 3.0.0 direct from the website
compadre <- cdb_fetch("compadre", version = "3.0.0")
# using file path to downloaded data
compadre <- cdb_fetch("data/COMPADRE_v.5.0.1.RData")
}