so_diet: Load data from the SCAR Southern Ocean Diet and Energetics...

View source: R/fetch_data.R

so_dietR Documentation

Load data from the SCAR Southern Ocean Diet and Energetics database

Description

Load data from the SCAR Southern Ocean Diet and Energetics database. Data will be fetched from the remote server and optionally cached locally, or fetched from the local cache, depending on the arguments passed.

Usage

so_diet(
  method = "get",
  cache_directory = "session",
  refresh_cache = FALSE,
  public_only = TRUE,
  verbose = FALSE
)

so_dna_diet(
  method = "get",
  cache_directory = "session",
  refresh_cache = FALSE,
  public_only = TRUE,
  verbose = FALSE
)

so_isotopes(
  method = "get",
  cache_directory = "session",
  refresh_cache = FALSE,
  public_only = TRUE,
  verbose = FALSE,
  format = "mv"
)

so_energetics(
  method = "get",
  cache_directory = "session",
  refresh_cache = FALSE,
  public_only = TRUE,
  verbose = FALSE
)

so_lipids(
  method = "get",
  cache_directory = "session",
  refresh_cache = FALSE,
  public_only = TRUE,
  verbose = FALSE
)

so_sources(
  method = "get",
  cache_directory = "session",
  refresh_cache = FALSE,
  public_only = TRUE,
  verbose = FALSE
)

Arguments

method

string: "get" (fetch the data via a web GET call)

cache_directory

string: (optional) cache the data locally in this directory, so that they can be used offline later. Values can be "session" (a per-session temporary directory will be used, default), "persistent" (the directory returned by rappdirs::user_cache_dir() will be used), or a string giving the path to the directory to use. Use NULL for no caching. An attempt will be made to create the cache directory if it does not exist. A warning will be given if a cached copy of the data file exists and is more than 30 days old. Use refresh_cache = TRUE to refresh the cached data if necessary

refresh_cache

logical: if TRUE, and data already exist in the cache_directory, they will be refreshed. If FALSE, the cached data will be used

public_only

logical: ignored, here for historical reasons

verbose

logical: show progress messages?

format

string: ignored, kept for historical purposes only

Details

The format parameter was introduced to the so_isotopes function in package version 0.4.0. The previous default format was "wide" (the data were formatted with one row per record and multiple measurements (of different isotopes) per row). With format "mv", the data were in measurement-value (long) format with multiple rows per original record, split so that each different isotope measurement appeared in its own row. As of package version 0.9.0, "wide" has been hard-deprecated and "mv" is the only option.

Value

data.frame

Examples

## Not run: 
  ## conventional diet data
  x <- so_diet()
  subset(x, predator_name == "Electrona antarctica")

  ## DNA diet data
  x <- so_dna_diet()
  subset(x, predator_name == "Thalassarche melanophris")

  ## stable isotopes
  x <- so_isotopes()

  ## energetics data
  x <- so_energetics()

  ## lipids data
  x <- so_lipids()

## End(Not run)

SCAR/sohungry documentation built on Nov. 2, 2023, 4:19 p.m.