View source: R/adfg.ScaleAndRebinZCs.R
adfg.ScaleAndRebinZCs | R Documentation |
Function to scale and rebin size compositions.
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
)
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 |
Uses sqldf::sqldf()
, reshape2::dcast()
, wtsUtilities::Sum()
, and wtsUtilities::applyCutPts()
.
Input column names should given "as is" and NOT be backquoted.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.