| PivotBatch {pivottabler} | R Documentation |
R6 class the represents a Calculation Batch
Description
The 'PivotBatch' class represents one combination of data, variables and calculations that are needed when calculating the values of cells in a pivot table.
Format
R6Class object.
Details
The combination of data name and variable names defines a batch. When the batch is calculated, the calculations specified in the batch are evaluated against the specified data, with the data being grouped by the variables specified in the batch. Individual result values can then be retrieved from the batch. See the "Performance" vignette for details.
Active bindings
batchIdThe unique identifier for the batch.
batchNameThe unique name of the batch.
compatibleCountThe number of pivot cell calculations that this batch supports.
evaluatedTRUE if this batch has been evaluated.
resultsThe results (a data frame) of the evaluation of the batch
asStringA text description of the batch.
Methods
Public methods
Method new()
Create a new 'PivotBatch' object.
Usage
PivotBatch$new( parentPivot = NULL, batchId = 0, dataName = NULL, variableNames = NULL, values = NULL, calculationName = NULL, calculationGroupName = NULL )
Arguments
parentPivotThe pivot table that this 'PivotBatch' instance belongs to.
batchIdThe unique identifier for the batch.
dataNameThe name of the data frame (as specified in 'pt$addData()') that this batch relates to.
variableNamesSpecifies the combination of variable names (i.e. dimensionality) of the batch.
valuesA list specifying the distinct list of values for each variable, i.e. 'list(varName1=values1, varName2=values2, ...)'. 'values' is not currently used and does not affect the batch compatibility logic.
calculationNameThe first calculation added to this batch. Does not affect the batch compatibility logic.
calculationGroupNameThe calculation group of the first calculation added to this batch. Does not affect the batch compatibility logic.
Returns
A new 'PivotBatch' object.
Method isCompatible()
Determine whether a combination of data and variables is compatible with this batch.
Usage
PivotBatch$isCompatible(dataName = NULL, variableNames = NULL)
Arguments
dataNameThe name of the data frame (as specified in 'pt$addData()').
variableNamesSpecifies the combination of variable names (i.e. dimensionality)..
Returns
'TRUE' or 'FALSE'.
Method addCompatible()
Add a new set of values or a new calculation to the batch. with this batch.
Usage
PivotBatch$addCompatible( values = NULL, calculationName = NULL, calculationGroupName = NULL )
Arguments
valuesA list specifying the distinct list of values for each variable, i.e. 'list(varName1=values1, varName2=values2, ...)'. 'values' is not currently used and does not affect the batch compatibility logic.
calculationNameThe calculation to add to the batch. Does not affect the batch compatibility logic.
calculationGroupNameThe calculation group of the calculation to add to the batch. Does not affect the batch compatibility logic.
Returns
No return value.
Method getCalculationInternalName()
Find the internal name of a calculation in the batch.
Usage
PivotBatch$getCalculationInternalName( calculationName = NULL, calculationGroupName = NULL )
Arguments
calculationNameThe name of the calculation to find.
calculationGroupNameThe calculation group of the calculation to find.
Returns
The internal name of the calculation in the batch.
Method evaluateBatch()
Carry out grouping and calculations to evaluate the batch.
Usage
PivotBatch$evaluateBatch()
Returns
No return value.
Method getSummaryValueFromBatch()
Retrieve one calculation value from the batch, typically for the value of one cell in a pivot table.
Usage
PivotBatch$getSummaryValueFromBatch( filters = NULL, calculationName = NULL, calculationGroupName = NULL )
Arguments
filtersA 'PivotFilters' instance that specifies which value to retrieve. This filters object is a combination of the row, column and calculation filters.
calculationNameThe name of the calculation value to retrieve.
calculationGroupNameThe calculation group of the calculation to retrieve.
Returns
A single calculation value.
Method clone()
The objects of this class are cloneable with this method.
Usage
PivotBatch$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
# This class should only be created by the pivot table.
# It is not intended to be created outside of the pivot table.