getPSUDensity: PSU level density

View source: R/density_wrappers.R

getPSUDensityR Documentation

PSU level density

Description

Calculates average density (individual/secondary sampling unit) for each primary sample unit

Usage

getPSUDensity(x, species, length_bins = NULL, merge_protected = TRUE, ...)

Arguments

x

A list containing three data.frames:

  • sample_data: sample counts and information

  • stratum_data: strata information. Including the number of possible primary sampling units per stratum (NTOT)

  • taxonomic_data: taxonomic and life history information

species

A character vector containing scientific names, common names, or species codes for the desired species, or a combination thereof

length_bins

Numeric vector, data.frame, or keyword.

  • vector: A number of numeric vector of lengths, in cm, of breakpoints by which the data will be binned. The same vector will be applied to all species. NOTE: Be wary of estimates produced using small length bins, as the associated variance may be large or misleading

  • data.frame: A lookup table containing two columns. The first column with scientific names or species codes, and the second containing lengths, in cm, by which to break up the data for each species

  • keyword: "lc" - breaks the data at minimum length at capture for each species. "lm" - breaks the data at median length at maturity for each species. NOTE: Generates length at capture and length at maturity from taxonomic data table. Can only be used if length at capture or length at maturity is available for the species in the taxonomic_data table. See getTaxonomicData

merge_protected

A boolean indicating whether protected and unprotected areas should be merged (TRUE, the default), or should be calculated seperately (FALSE)

...

Optional filters to apply to the data:

strata

Character vector of strata codes to include. Strata codes vary by region

status

Numeric vector of protected statuses

is_protected

Boolean indicating whether only protected areas should be included (TRUE), only unprotected areas (FALSE), or both (NULL, the default). Must be NULL if merge_protected is FALSE

years

Numeric vector of years to include

regions

Character vector of region codes: (e.g. "FLA KEYS", "DRY TORT", "SEFCRI") to include

when_present

Boolean indicating whether to only include records where individuals present (TRUE), or not (FALSE)

group

A lookup table (data.frame): the first column of which is a list of species codes, scientific names, or common names, and the second column of which is a list of names by which to group the species (e.g. Family names, trophic groups, etc). If this option is used instead of the statistic being calculated per species, it will be calculated per group

Value

A data.frame with:

YEAR

The year

REGION

A code for the region: DRY TORT - Dry Tortugas, SEFCRI - Southeast Peninsular Florida, FLA KEYS - Florida Keys

STRAT

A code for the stratum

PROT

A boolean indicating protected status: 1 - Protected, 2 - Unprotected

PRIMARY_SAMPLE_UNIT

primary sample unit ID

SPECIES_CD

The species code. The first three letters of the genus name and first four of the species name. If group is passed as an argument, SPECIES_CD will be changed to GROUP

m

Number of secondary sampling units sampled

var

Variance in average density per secondary sampling unit

density

Average density per secondary sampling unit

length_class

The length class or bin. Only present if length_bins is not NULL. The notation, [lower, upper), is inclusive of the lower bound, but exclusive of the upper bound

protected_status

The protected status. Only present if merge_protected is FALSE

See Also

getRvcData getDomainDensity

Examples

## Get RVC data from 2011 in the Florida Keys
fk2011 = getRvcData(years = 2011, regions = "FLA KEYS")

## Calculate PSU density for Red Grouper
getPSUDensity(fk2011, species = "Red Grouper")

harryganz/rvc documentation built on Feb. 14, 2023, 4:13 p.m.