calcSizeComps: Create "size" compositions from a dataframe with count data

View source: R/calcSizeComps.R

calcSizeCompsR Documentation

Create "size" compositions from a dataframe with count data

Description

Function to create a dataframe of "size" compositions from a dataframe with count data.

Usage

calcSizeComps(
  dfrZ,
  id.size = "size",
  id.value = "abundance",
  id.facs = "",
  cutpts = NULL,
  truncate.low = FALSE,
  truncate.high = FALSE,
  expandToAllFactorCombos = FALSE,
  normalize = FALSE,
  id.normfacs = "",
  rescale = FALSE,
  dfrScalars = NULL,
  id.scalevalue,
  id.scalefacs = id.normfacs,
  verbose = FALSE
)

Arguments

dfrZ

- input dataframe with count/abundance data by size and other factors

id.size

- name of column in dfr with "size" data

id.value

- name of column in dfrZ with count (or abundance) values

id.facs

- character vector of column names to use as factors in calculating size compositions

cutpts

- cut points for size bins

truncate.low

-flag to truncate counts/abundance below the minimum size or include in first size bin (FALSE)

truncate.high

- flag to truncate counts/abundance above the maximum size (TRUE) or include in final size bin (FALSE)

expandToAllFactorCombos

- flag (T/F) to expand size comps to include all factor combinations

normalize

- flag (T/F) to normalize size comps (i.e., sum to 1 acorss normalizing factors)

id.normfacs

- character vector of column names of factors to normalize the size compositions across when scaling to total abundance

rescale

- flag to rescale size compositions by factor combination using scalars in dfrA

dfrScalars

- [optional] input dataframe with scalars to apply by a subset of the factors in dfr

id.scalevalue

- column name for scale value in dfrA

id.scalefacs

- character vector of column names of factors in dfrA to scale the size compositions across

verbose

- flag to print diagnostic output to console

Details

Non-standard column names should be back-quoted. The names of columns (id.normfacs) used to normalize the composition data in dfrZ prior to expanding to total abundance using dfrScalars should represent the same factors (id.scalefacs) and levels in both datasets.

Value

dataframe with summed counts (or abundance) as compositions by size (and possibly other factors).


wStockhausen/wtsSizeComps documentation built on March 17, 2024, 3:09 p.m.