PivotBatchCalculator | R Documentation |
The 'PivotBatchCalculator' class calculates the values for multiple cells in the pivot table in one evaluation step (per batch), instead of evaluating every calculation once per pivot table cell.
R6Class
object.
Evaluating a set of filters and calculations repetitively for each cell is inefficient and slow. The Batch Calculator executes a much small number of calculations which greatly reduces the CPU time and elapsed time required. See the "Performance" vignette for details.
batchCount
The number of batches generated for the pivot table.
calculationSummary
A summary of the batch compatibility for each calculation.
batchSummary
A summary of the batches in the pivot table.
PivotBatchCalculator$generateBatchesForNamedCalculationEvaluation1()
PivotBatchCalculator$generateBatchesForNamedCalculationEvaluation2()
new()
Create a new 'PivotBatchCalculator' object.
PivotBatchCalculator$new(parentPivot = NULL)
parentPivot
The pivot table that this 'PivotBatchCalculator' instance belongs to.
A new 'PivotBatchCalculator' object.
reset()
Reset the batch calculator, clearing all existing batches.
PivotBatchCalculator$reset()
No return value.
checkValidWorkingData()
Run some additional checks to see whether the working data is valid. Typically only used in development builds of the package.
PivotBatchCalculator$checkValidWorkingData(workingData = NULL)
workingData
The working data to check.
No return value.
isFiltersBatchCompatible()
Examines a set of filters to see whether they are compatible with batch evaluation mode. Only filters that specify zero or one value for each variable are compatible with batch evaluation.
PivotBatchCalculator$isFiltersBatchCompatible(filters = NULL)
filters
A 'PivotFilters' object that represents a set of filters to examine.
It is not practical to make batch evaluation work where a filter matches more than one value for a variable. One approach might be to add a derived column where a single value represents the multiple values, however the combination of values could partially overlap with combinations of values in other data groups. Also the value that represents the "combined" value could collide with other existing values in the column. In summary: Sequential mode is slower and more flexible. Batch is faster but stricter. Batch mode works for regular pivot tables (i.e. most cases).
'TRUE' if the filters are batch compatible, 'FALSE' otherwise.
generateBatchesForNamedCalculationEvaluation1()
Generates a new batch or finds a relevant existing batch for a named calculation and single working filters object.
PivotBatchCalculator$generateBatchesForNamedCalculationEvaluation1( dataName = NULL, calculationName = NULL, calculationGroupName = NULL, workingFilters = NULL )
dataName
The name of the data frame (as specified in 'pt$addData()').
calculationName
The name of the calculation.
calculationGroupName
The calculation group of the calculation.
workingFilters
A 'PivotFilters' object that represents the working filters to generate the batch for.
The name of either the batch that was created or the relevant existing batch.
generateBatchesForNamedCalculationEvaluation2()
Generates one or more batches for the named calculations and set of working working data associated with a cell.
PivotBatchCalculator$generateBatchesForNamedCalculationEvaluation2( calculationName = NULL, calculationGroupName = NULL, workingData = NULL )
calculationName
The name of the calculation.
calculationGroupName
The calculation group of the calculation.
workingData
A list containing filter and/or filter overrides.
A wrapper around 'generateBatchesForNamedCalculationEvaluation1()', which invokes this function as appropriate, depending on whether a calculation if either of type "summary" or type "calculation".
One or more batch names of either the batches that were created or the relevant existing batches.
generateBatchesForCellEvaluation()
Generates the batches for batch evaluation mode.
PivotBatchCalculator$generateBatchesForCellEvaluation()
One or more batch names of either the batches that were created or the relevant existing batches.
evaluateBatches()
Evaluate each of the batches defined in the batch calculator.
PivotBatchCalculator$evaluateBatches()
The number of batches that were evaluated.
getSummaryValueFromBatch()
Retrieve one calculation value from one batch, typically for the value of one cell in a pivot table.
PivotBatchCalculator$getSummaryValueFromBatch( batchName = NULL, calculationName = NULL, calculationGroupName = NULL, workingFilters = NULL )
batchName
The name of the batch containing the calculation result.
calculationName
The name of the calculation.
calculationGroupName
The calculation group of the calculation.
workingFilters
A 'PivotFilters' object that represents the working filters to retrieve the value for.
A single calculation value.
clone()
The objects of this class are cloneable with this method.
PivotBatchCalculator$clone(deep = FALSE)
deep
Whether to make a deep clone.
# This class should only be created by the pivot table.
# It is not intended to be created outside of the pivot table.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.