addRadCap: Add total radius-at-capture to wide increments data.

View source: R/growthDataUtils.R

addRadCapR Documentation

Add total radius-at-capture to wide increments data.

Description

Add a total radius-at-capture variable to a data.frame that contains one-fish-per-line (i.e., “wide” format) increments data.

Usage

addRadCap(df, in.pre = NULL, in.var = NULL, var.name = "radcap")

Arguments

df

A data.frame that contains the growth increment data in one-fish-per-line (i.e., “wide”) format.

in.pre

A string that represents the common part of the increment variable names. See details.

in.var

A vector of variables in df that do not change. See details.

var.name

A string that indicates the name for the new total radius-at-capture variable in the new data.frame. Defaults to “radcap”.

Details

The columns that contain the original increment data can specified in a variety of ways. First, if all columns begin with the same prefix (and no other columns contain that prefix), then the prefix string may be given to in.pre=. Second, a sequence of column numbers may be given to in.var= with #:# (if the columns are contiguous) or as a vector (if the columns are not contiguous). Third, a vector of column names may be given to in.var=. Note that one, but not both, of in.var= or in.pre= must be specified by the user.

Note that the computed total radius-at-capture will only be the actual total radius-at-capture if all growth, including “plus-growth” in the current season, is recorded in the input data frame.

Value

A data.frame of increments in one-fish-per-line (i.e., “wide”) format with the total radius-at-capture appended in a variable named as given in var.name.

Author(s)

Derek H. Ogle, derek@derekogle.com

See Also

See gConvert for related functionality.

Examples

## Get data with radial measurements
data(SMBassWB,package="FSA")
head(SMBassWB)

## convert radial measurements to increments
SMBi1 <- gConvert(SMBassWB,in.pre="anu",out.type="inc")
head(SMBi1)

## add the radius-at-capture measurement
SMBi1a <- addRadCap(SMBi1,in.pre="inc",var.name="radcap2")
head(SMBi1a)


RFishBC documentation built on Aug. 29, 2023, 9:06 a.m.

Related to addRadCap in RFishBC...