aggregateBaselineDataOneTableSingleFunction: Function to aggregate baseline data

View source: R/Report.R

aggregateBaselineDataOneTableSingleFunctionR Documentation

Function to aggregate baseline data

Description

Function to aggregate baseline data

Usage

aggregateBaselineDataOneTableSingleFunction(
  stoxData,
  subTable = character(),
  TargetVariable,
  ReportFunction = getReportFunctions(),
  GroupingVariables = character(),
  InformationVariables = character(),
  na.rm = FALSE,
  padWithZerosOn = character(),
  Specification = list(),
  uniqueGroupingVariablesToKeep = NULL
)

Arguments

stoxData

Output from any StoX function.

subTable

The name of the sub table to aggregate on, if stoxData is a list of tables.

TargetVariable

The variable to report.

ReportFunction

The name of a function to report the Baseline process output by. This must be a function returning a single value. See ReportFunctions for implemented funcitons.

GroupingVariables

The variables to report by. For most applications GroupingVariables should include "Survey" and "SpeciesCategory", unless the user needs to sum over all Survey or SpeciesCategory.

InformationVariables

Variables to include as columns to the end of the report table. These cannot have more unique combinations than the GroupingVariables.

na.rm

Used in the function specified by ReportFunction.

padWithZerosOn

Character vector giving the variables for which missing values should be padded with zeros. This is used particularly for bootstrapping, where a fish length missing in a bootstrap run should be considered as samples with zero individuals, and not missing, so that summary statistics end up taking all bootstrap replicates into account (if not a mean would be overestimated). When padWithZerosOn has positive length, padding with zeros is applied to this variable and to the GroupingVariables.

Specification

A named list of specification parameters used in the ReportFunction.

uniqueGroupingVariablesToKeep

A data.table holding unique combinations to extract from the data, used by RstoxFramework::ReportBootstrap() to discard combinations of the grouping variables what do not exist in the data. Such combinations are introduced with the CJ operation when padWithZerosOn is given.

Value

An aggregated version of the input stoxData.

See Also

ReportSuperIndividuals


StoXProject/RstoxBase documentation built on July 14, 2024, 9:39 a.m.