The `PivotCalculationGroups` class stores all of the calculation groups for a pivot table. Every pivot table has at least one pivot calculation group and this is sufficient for all regular pivot tables. Additional calculation groups are typically only created for irregular/custom pivot tables. See the "Irregular Layout" vignette for an example.

Format

R6Class object.

Active bindings

count

The number of calculation groups in the pivot table.

groups

A list containing the calculation groups in the pivot table.

defaultGroup

The default calculation group in the pivot table.

Methods

Public methods


Method new()

Create a new `PivotCalculationGroups` object.

Usage

PivotCalculationGroups$new(parentPivot)

Arguments

parentPivot

The pivot table that this `PivotCalculationGroups` instance belongs to.

Returns

A new `PivotCalculationGroups` object.


Method isExistingCalculationGroup()

Check if a calculation group exists with the specified name.

Usage

PivotCalculationGroups$isExistingCalculationGroup(calculationGroupName = NULL)

Arguments

calculationGroupName

The name of the calculation group.

Returns

`TRUE` if the calculation group already exists, `FALSE` otherwise.


Method item()

Retrieve a calculation group by index.

Usage

PivotCalculationGroups$item(index)

Arguments

index

An integer specifying the calculation group to retrieve.

Returns

The calculation group that exists at the specified index.


Method getCalculationGroup()

Retrieve a calculation group by name.

Usage

PivotCalculationGroups$getCalculationGroup(calculationGroupName = NULL)

Arguments

calculationGroupName

The name of the calculation group to retrieve.

Returns

The calculation group with the specified name.


Method addCalculationGroup()

Create a new calculation group.

Usage

PivotCalculationGroups$addCalculationGroup(calculationGroupName = NULL)

Arguments

calculationGroupName

The name of the calculation group to create

Returns

The new calculation group.


Method asList()

Return the contents of this object as a list for debugging.

Usage

PivotCalculationGroups$asList()

Returns

A list of various object properties.


Method asJSON()

Return the contents of this object as JSON for debugging.

Usage

PivotCalculationGroups$asJSON()

Returns

A JSON representation of various object properties.


Method asString()

Return a representation of this object as a character value.

Usage

PivotCalculationGroups$asString(seperator = ", ")

Arguments

seperator

A character value used when concatenating the text representations of different calculation groups.

Returns

A character summary of various object properties.


Method clone()

The objects of this class are cloneable with this method.

Usage

PivotCalculationGroups$clone(deep = FALSE)

Arguments

deep

Whether 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.