cover_mean_c: Calculate Cover-Weighted Mean C

View source: R/cover_metrics.R

cover_mean_cR Documentation

Calculate Cover-Weighted Mean C

Description

cover_mean_c calculates the sum of cover multiplied by the C value per each species, divided by the sum of cover values for all species.

Usage

cover_mean_c(
  x,
  key = "name",
  db,
  native = FALSE,
  cover_class = "percent_cover",
  allow_duplicates,
  plot_id = NULL
)

Arguments

x

A data frame containing a list of plant species. This data frame must have one of the following columns: name or acronym. For cover-weighted or relative functions, this data frame must also have a column called cover containing cover values and ideally a column containing plot IDs.

key

A character string representing the column that will be used to join the input data frame x with the regional FQA database. If a value is not specified, the default is "name". "name" and "acronym" are the only acceptable values for key.

db

A character string representing the regional FQA database to use. See db_names for a list of potential values and the fqadata R package where the databases are hosted.

native

Boolean (TRUE or FALSE). If TRUE, calculate metrics using only native species.

cover_class

a character string representing the cover classification used. Acceptable cover classes are: "percent_cover", "carolina_veg_survey", "braun-blanquet", "daubenmire", and "usfs_ecodata". "percent_cover" is the default.

allow_duplicates

Boolean (TRUE or FALSE). If TRUE, allow x to have duplicate observations for the same species. This is only recommended for calculating transect and relative frequency/abundance metrics. For non cover-weighted (inventory) assessments allow_duplicates is always FALSE. For cover-weighted functions, allow_duplicates can be set to TRUE for transect level metrics or FALSE for plot level metrics.

plot_id

A character string representing the column in x that contains plot identification values. plot_id is a required argument in plot_summary, where it acts as a grouping variable. plot_id is optional but highly recommended for cover-weighted functions and relative functions. If plot_id is set in a cover-weighted function or a relative function, it only prevents duplicates from occurring in the same plot. It does not act as a grouping variable.

Value

A non-negative number

Examples

plot <- data.frame(acronym  = c("ABEESC", "ABIBAL", "AMMBRE", "ANTELE"),
cover = c(50, 4, 20, 30),
plot_id = c(1, 1, 2, 2))

cover_mean_c(x = plot, key = "acronym", db = "michigan_2014", native = FALSE,
allow_duplicates = FALSE, plot_id = "plot_id")

fqacalc documentation built on Sept. 26, 2023, 5:10 p.m.