getDomainLengthFrequency: Domain level length frequency

View source: R/length_frequency_wrappers.R

getDomainLengthFrequencyR Documentation

Domain level length frequency

Description

Calculates length frequency for each sampling domain

Usage

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

A numeric vector of lengths, in centimenters, by which to bin the data. If NULL (default), will not bin the data. Note: Lengths below the minimum and above the maximum value in length_bins will be assigned <NA> (with no differentiation between below and above the provided bins). It is suggested that the bins match or exceed the range of lengths for the species in which you are interested

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

length_class

The actual measured lengths, in cm, if length_bins = NULL, or an interval, if length_bins is not NULL

frequency

The relative frequency of each length class within each sampling domain

See Also

getRvcData getStratumLengthFrequency

Examples

## Get rvc data from the Florida Keys in 2005
fk2005 = getRvcData(years = 2005, regions = "FLA KEYS")

## Calculate stratum length frequencies for Mangrove Snapper
getDomainLengthFrequency(fk2005, species = "LUT GRIS")

## Calculate length frequencies for mangrove snappers in
## 1cm bins
getDomainLengthFrequency(fk2005, species = "LUT GRIS", length_bins = seq(0,100,1))

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