get_ems_data: get EMS data from BC Data Catalogue

View source: R/get_ems_data.R

get_ems_dataR Documentation

get EMS data from BC Data Catalogue

Description

EMS data are distributed through the BC Data Catalogue under the Open Government License - British Columbia. This function downloads the chosen data ('historic' - 1964-2014, or '2yr' or '4yr') and imports it into your R session. It also caches the data so subsequent loads are much faster - if the data in the Data Catalogue are more current than that in your cache, you will be prompted to update it.

Usage

get_ems_data(
  which = "2yr",
  n = Inf,
  cols = "wq",
  force = FALSE,
  ask = TRUE,
  dont_update = FALSE,
  check_only = FALSE
)

Arguments

which

Defaults to "2yr" (past 2 years). You can also specify "4yr" to get the past four years of data. If you want historic data, use the download_historic_data and read_historic_data functions.

n

how many rows of the data do you want to load? Defaults to all (n = Inf).

cols

which subset of columns to read. Can be "all" which reads all columns, "wq" (default) which returns a predefined subset of columns common for water quality analysis, or a character vector of column names (see details below).

force

Default FALSE. Setting to TRUE will download new data even if it's not out of date on your computer.

ask

should the function ask for your permission to download and cache data on your computer? Default TRUE

dont_update

should the function checking for updates to the data and simply load the data from the cache? Default FALSE

check_only

should the function retrieve the data from the cache or just check it's existence and currency? Default FALSE

Details

cols can specify any of the following column names as a character vector:

"EMS_ID", "MONITORING_LOCATION", "LATITUDE", "LONGITUDE", "LOCATION_TYPE", "COLLECTION_START", "COLLECTION_END", "LOCATION_PURPOSE", "PERMIT", "PERMIT_RELATIONSHIP", "DISCHARGE_TO", "REQUISITION_ID", "SAMPLING_AGENCY", "ANALYZING_AGENCY", "COLLECTION_METHOD", "SAMPLE_CLASS", "SAMPLE_STATE", "SAMPLE_DESCRIPTOR", "PARAMETER_CODE", "PARAMETER", "ANALYTICAL_METHOD_CODE", "ANALYTICAL_METHOD", "RESULT_LETTER", "RESULT", "UNIT", "METHOD_DETECTION_LIMIT", "MDL_UNIT", "QA_INDEX_CODE", "UPPER_DEPTH", "LOWER_DEPTH", "TIDE", "AIR_FILTER_SIZE", "AIR_FLOW_VOLUME", "FLOW_UNIT", "COMPOSITE_ITEMS", "CONTINUOUS_AVERAGE", "CONTINUOUS_MAXIMUM", "CONTINUOUS_MINIMUM", "CONTINUOUS_UNIT_CODE", "CONTINUOUS_DURATION", "CONTINUOUS_DURATION_UNIT", "CONTINUOUS_DATA_POINTS", "TISSUE_TYPE", "SAMPLE_SPECIES", "SEX", "LIFE_STAGE", "BIO_SAMPLE_VOLUME", "VOLUME_UNIT", "BIO_SAMPLE_AREA", "AREA_UNIT", "BIO_SIZE_FROM", "BIO_SIZE_TO", "SIZE_UNIT", "BIO_SAMPLE_WEIGHT", "WEIGHT_UNIT", "BIO_SAMPLE_WEIGHT_FROM", "BIO_SAMPLE_WEIGHT_TO", "WEIGHT_UNIT_1", "SPECIES", "RESULT_LIFE_STAGE"

The default value of cols is "wq", which will return a data frame with the following columns:

"EMS_ID", "MONITORING_LOCATION", "LATITUDE", "LONGITUDE", "LOCATION_TYPE", "COLLECTION_START", "LOCATION_PURPOSE", "PERMIT", "SAMPLE_CLASS", "SAMPLE_STATE", "SAMPLE_DESCRIPTOR", "PARAMETER_CODE", "PARAMETER", "ANALYTICAL_METHOD_CODE", "ANALYTICAL_METHOD", "RESULT_LETTER", "RESULT", "UNIT", "METHOD_DETECTION_LIMIT", "QA_INDEX_CODE", "UPPER_DEPTH", "LOWER_DEPTH"

Value

a data frame or TRUE if check_only = TRUE


bcgov/rems documentation built on Oct. 14, 2023, 3:04 a.m.