adfg.ScaleAndRebinZCs: Scale and rebin size compositions

View source: R/adfg.ScaleAndRebinZCs.R

adfg.ScaleAndRebinZCsR Documentation

Scale and rebin size compositions

Description

Function to scale and rebin size compositions.

Usage

adfg.ScaleAndRebinZCs(
  mdfrScl,
  mdfrZCs,
  aggFacs = c("shell condition"),
  scaleCol = "abundance",
  sizeCol = "size",
  valCol = "count",
  cutpts = seq(from = 5, to = 185, by = 5),
  truncate.low = TRUE,
  truncate.high = FALSE,
  returnSampleSizes = FALSE,
  verbose = FALSE
)

Arguments

mdfrScl

: dataframe with scaling information

mdfrZCs

: "raw" size compositions (counts) to scale and rebin

aggFacs

: character vector of biological factors over which to aggregate (e.g., shell condition)

scaleCol

: name of column in mdfrScl with scale information

sizeCol

: name of column in mdfrZCs with sizes to rebin

valCol

: name of column in mdfrZCs with values to scale

cutpts

: vector of cutpoints

truncate.low

: flag to truncate below first cutpoint (i.e., cutpt[1]<-0)

truncate.high

: flag to truncate above last cutpoint (i.e., cutpt[last]<-Inf)

returnSampleSizes

: flag to return sample sizes as well as size compositions (default=FALSE)

verbose

: flag (T/F) to print diagnostic information

Details

Uses sqldf::sqldf(), reshape2::dcast(), wtsUtilities::Sum(), and wtsUtilities::applyCutPts(). Input column names should given "as is" and NOT be backquoted.

Value

If returnSampleSizes is FALSE, a dataframe with same columns as mdfrZCs, except that the valCol column is renamed to that in scaleCol.

If returnSampleSizes is TRUE, then the return value is a list with named elements

  • tblSS -a dataframe with sample sizes

  • tblZCs - the scaled, rebinned and expanded size compositions


wStockhausen/tcsamFisheryDataADFG documentation built on April 18, 2023, 12:56 p.m.