Learn R Programming

FSA (version 0.8.6)

addRadCap: Add a total radius-at-capture variable to a data.frame that contains one-fish-per-line increments data.

Description

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

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.

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 (defaults to radcap).

Details

#' The columns that contain the original measurement 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 the #:#} (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 \code{in.var=}. Note that one, but not both, of \code{in.var=} or \code{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. ## Get data with radial measurements data(SMBassWB) headtail(SMBassWB) ## convert radial measurements to increments SMBi1 <- gConvert(SMBassWB,in.pre="anu",out.type="inc") headtail(SMBi1) ## add the radius-at-capture measurement SMBi1a <- addRadCap(SMBi1,in.pre="inc",var.name="radcap2") headtail(SMBi1a) [object Object],[object Object] See gConvert for related functionality. manip