getDomainDensity: Domain level density

View source: R/density_wrappers.R

getDomainDensityR Documentation

Domain level density

Description

Calculates average density (individual/secondary sampling unit) for each sampling domain (year/region)

Usage

getDomainDensity(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

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

density

Average density per secondary sampling unit

var

Variance in average density per secondary sampling unit

n

Number of primary sampling units sampled

nm

Number of secondary sampling units sampled

N

Number of possible primary sample units

NM

Number of possible secondary sampling units

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 getStratumDensity

Examples

## Get data for the Dry Tortugas in 2008
dt2008 = getRvcData(years = 2008, regions = "DRY TORT")

## Calculate density for Black Grouper
getDomainDensity(dt2008, species = "Myc bona")

## Calculate density for Black Grouper in and outside of protected areas
getDomainDensity(dt2008, species = "Black Grouper", merge_protected = FALSE)

## Calculate density for Black Grouper above and below 60cm
getDomainDensity(dt2008, species = "Mycteroperca bonaci", length_bins = 60)

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