ReportDensity: Report DensityData

View source: R/Report.R

ReportDensityR Documentation

Report DensityData

Description

Reports the sum, mean or other functions on a variable of the DensityData.

Usage

ReportDensity(
  DensityData,
  DensityUnit = character(),
  ReportFunction = getReportFunctions(use = "Baseline"),
  GroupingVariables = character(),
  InformationVariables = character(),
  Filter = character(),
  RemoveMissingValues = FALSE,
  WeightingVariable = character(),
  ConditionOperator = character(),
  ConditionValue = character(),
  FractionOverVariable = character()
)

Arguments

DensityData

The DensityData data.

DensityUnit

The unit to use for the Density. Run the following in R for possible units: subset(RstoxData::StoxUnits, quantity == "area_number_density", select = "shortname").

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.

Filter

A string with an R expression to filter out unwanted rows of the report, e.g. "IndividualAge %notin% NA" or "Survey %notin% NA & SpeciesCategory %notin% NA".

RemoveMissingValues

Logical: If TRUE, remove missing values (NAs) from the TargetVariable. The default (FALSE) implies to report NA if at least one of the values used in the ReportFunction is NA. Use RemoveMissingValues = TRUE with extreme caution, as it may lead to under-estimation. E.g., if RemoveMissingValues = TRUE and a super-individual lacks IndividualRoundWeight, Biomass will be NA, and the portion of Abundance distributed to that super-individual will be excluded when summing Biomass (but included when summing Abundance). It is advised to always run with RemoveMissingValues = FALSE first, and make a thorough investigation to identify the source of any missing values. The function link{ImputeSuperIndividuals} can be used to impute the missing information from other super-individuals.

WeightingVariable

The variable to weight by. Only relevant for ReportFunction "weighted.mean". Note that missing values in the WeightingVariable results in missing value from the weighted.mean function as per the documentation of this function, regardles of any RemoveMissingValues.

ConditionOperator, ConditionValue

Expressions (strings) giving the condition for the ReportFunction number and fractionOfOccurrence. Supported values for ConditionOperator are "%in%", "%notin%", "==", "!=", "%notequal%", "<", "<=", ">=", ">". The ConditionOperator and ConditionValue are pasted for use in data.table.

FractionOverVariable

When ReportFunction is a fraction ("fractionOfOccurrence" or "fractionOfSum") FractionOverVariable is a string naming the variable (one of the GroupingVariables) to sum over in the denominator of the fraction.

Value

A ReportDensityData object.


StoXProject/RstoxBase documentation built on Nov. 6, 2024, noon