Package 'ramlegacy'

Title: Download and Read RAM Legacy Stock Assessment Database
Description: Contains functions to download, cache and read in 'Excel' version of the RAM Legacy Stock Assessment Data Base, an online compilation of stock assessment results for commercially exploited marine populations from around the world. The database is named after Dr. Ransom A. Myers whose original stock-recruitment database, is no longer being updated. More information about the database can be found at <https://ramlegacy.org/>. Ricard, D., Minto, C., Jensen, O.P. and Baum, J.K. (2012) <doi:10.1111/j.1467-2979.2011.00435.x>.
Authors: Carl Boettiger [aut, cph] , Kshitiz Gupta [aut, cre, cph], Sam Albers [rev] , Jamie Afflerbach [rev] , RAM Legacy Stock Assessment Database [dtc]
Maintainer: Kshitiz Gupta <[email protected]>
License: MIT + file LICENSE
Version: 0.2.0
Built: 2024-11-14 04:59:38 UTC
Source: https://github.com/ropensci/ramlegacy

Help Index


Download RAM Legacy Excel Database

Description

Downloads a specified version of RAM Legacy Stock Assessment Excel Database and as an RDS object to a local directory specified by ram_dir. The function will check if the version requested already exists on the user's computer and if it does then it prompts the user to download it again unless 'overwrite = TRUE' in which case the function will download the version without displaying the prompt. The function also supports downloading all the older versions (1.0, 2.0, 2.5, 3.0, 4.3) from [a github repo](www.github.com/kshtzgupta1/ramlegacy-assets)

Usage

download_ramlegacy(version = NULL, ram_path = NULL,
  ram_url = "https://doi.org/10.5281/zenodo.2542918",
  overwrite = FALSE, quiet = FALSE)

Arguments

version

A character vector of length 1 specifying the version number of the database that should be downloaded. As of writing this package, the available versions are "1.0","2.0", "2.5", "3.0", "4.3", "4.40", "4.41", and "4.44". If the version argument is not specified then it defaults to latest version (currently latest version is "4.44").

ram_path

A string specifying the path of the local directory where database will be downloaded. By default this path is set to the location provided by rappdirs package and can be viewed by calling ram_dir. Although this is not the recommended approach download_ramlegacy supports downloading to a user-specified path.

ram_url

A string. By default it is set to the Zenodo url of the database. Please do not pass in any other url to ram_url.

overwrite

This argument is only relevant if you are trying to re-download a version that is already present locally in the rappdirs directory. If overwrite = TRUE then user will not encounter the interactive prompt that confirms whether to overwrite the version present locally.

quiet

If TRUE, suppress status messages

See Also

Other ramlegacy functions: load_ramlegacy, ram_dir

Examples

# download version 4.44
download_ramlegacy(version = "4.44")

# download version 1.0
download_ramlegacy(version = "1.0")

# If version not specified then default
# to latest version (currently 4.44)
download_ramlegacy()

Read-in dataframes from downloaded RAM Legacy Database

Description

Returns a list of specific dataframes or a list of all the dataframes present in the requested version of the database.

Usage

load_ramlegacy(version = NULL, tables = NULL, ram_path = NULL)

Arguments

version

A character vector of length 1 specifying the version number of the database. As of writing this package, the available versions are "1.0", "2.0", "2.5", "3.0", "4.3", "4.40", "4.41" and "4.44". If version argument is not specified then it defaults to newest version (v4.44).

tables

A character vector specifying the names of particular dataframes to load from a specified version. If not specified then a list containing all the dataframes within the requested version is returned. For a description of the different tables present in the database please see below.

ram_path

path to the local directory where the specified version of the RAM Legacy Stock Excel Assessment Database was downloaded. By default this path is set to within the rappdirs directory and can be viewed using calling the function ram_dir and specifying the version number inside the function call. Although this is not the recommended approach load_ramlegacy supports reading in the database's dataframes from a user-specified path provided that the database is present at the specified path as an rds object.

Description of the dataframes present in the database

  • metadata: Table with summarized metadata (only available in newer versions starting from v4.40)

  • stock: This stores the stock database table

  • assessment: This stores the assessment database table

  • taxonomy: This stores the taxonomy database table

  • management: This stores the management database table

  • assessor: This stores the assessor database table

  • assessmetod: This stores the assessmetod database table

  • area: This stores the area database table

  • biometrics: This stores the biometrics database table

  • tsmetrics: This stores the tsmetrics database table

  • timeseries: The time series data is a matrix object with the following headers/columns: (1) assessid (2) stockid (3) stocklong (4) tsid (5) tsyear (6) tsvalue

  • bioparams: The parameter data is a matrix object with the following headers/columns: (1) assessid (2) stockid (3) stocklong (4) bioid (5) biovalue (6) bioyear (7) bionotes

  • timeseries_values_views: This stores the timeseries values with timeseries type along the columns and stocks along the rows

  • timeseries_units_views: This stores the timeseries values with timeseries type along the columns and stocks along the rows

  • timeseries_ids_views: This stores the timeseries IDs with timeseries type along the columns and stocks along the rows

  • timeseries_assessments_views: This stores the timeseries assessments with timeseries type along the columns and stocks along the rows

  • timeseries_notes_views: This stores the timeseries notes with timeseries type along the columns and stocks along the rows

  • timeseries_sources_views: This stores the timeseries sources with timeseries type along the columns and stocks along the rows

  • timeseries_years_views: This stores the timeseries years with timeseries type along the columns and stocks along the rows

  • bioparams_values_views: This stores the reference point values, with reference point type along the columns and stocks along the rows

  • bioparams_units_views: This stores the reference point units, with reference point type along the columns and stocks along the rows

  • bioparams_ids_views: This stores the reference point IDs, with reference point type along the columns and stocks along the rows

  • bioparams_assessments_views: This stores the reference point assessments, with reference point type along the columns and stocks along the rows

  • bioparams_sources_views: This stores the reference point sources, with reference point type along the columns and stocks along the rows

  • bioparams_notes_views: This stores the reference point notes, with reference point type along the columns and stocks along the rows

Newer versions (v4.40 onwards) also contains tables of individual most-used time series

  • tb.data: Total Biomass

  • ssb.data: Spawning Stock Biomass

  • tn.data: Total Abundance

  • r.data: Recruits

  • tc.data: Total Catch

  • tl.data: Total Landings

  • recc.data: Recreational Catch

  • f.data: Fishing Mortality

  • er.data: Exploitation Rate

  • divtb.data: TB/TBmsy

  • divssb.data: SSB/SSBmsy

  • ivf.data: F/Fmsy

  • diver.data: ER/ERmsy

  • divbpref.data: B/Bmsypref

  • divupref.data: U/Umsypref

  • tbbest.data: TBbest

  • tcbest.data: TCbest

  • erbest.data: ERbest

  • divtb.mgt.data: TB/TBmgt

  • divssb.mgt.data: SSB/SSBmgt

  • divf.mgt.data: F/Fmgt

  • diver.mgt.data: ER/ERmgt

  • divbpref.mgt.data: B/Bmgtpref

  • divupref.mgt.data: U/Umgtpref

  • cpair.data: Cpair

  • tac.data: TAC

  • cadv.data: Cadvised

  • survb.data: survB

  • cpue.data: CPUE

  • effort.data: EFFORT

See Also

Other ramlegacy functions: download_ramlegacy, ram_dir

Examples

# first download version 4.44 of the database
download_ramlegacy(version = "4.44")

# get a list containing area and bioparams tables
# from version 4.44 database
load_ramlegacy(version = "4.44", tables = c("area", "bioparams"))

Output OS-independent path to the rappdirs directory on user's computer where the RAM Legacy database is downloaded by default

Description

Provides the download location for download_ramlegacy in an OS independent manner. This is also the location from where load_ramlegacy loads the database from.

Usage

ram_dir(vers = NULL)

Arguments

vers

character, version number of the database. As of writing this package, the available versions are "1.0", "2.0", "2.5", "3.0", "4.3","4.40", "4.41", and "4.44". If version is not specified the ram_dir() returns the path to the rappdirs top-level directory which stores all the version subdirectories.

See Also

Other ramlegacy functions: download_ramlegacy, load_ramlegacy

Examples

# return the path to the rappdirs directory where
# all version subdirectories are stored
ram_dir()

# Returns the path of the subdirectory where v4.3
# of the database is downloaded to and read from.
ram_dir(vers = "4.3")