The PivotData class stores all of the data frames associated with a pivot table. Each data frame can have a set of associated "totals" data frames, which are used to enable the "value" calculation type.

Format

R6Class object.

Active bindings

count

The number of named data frames in the pivot table (excluding totals/aggregate data frames).

defaultData

The default data frame in the pivot table.

defaultName

The name of the default data frame in the pivot table.

Methods

Public methods


Method new()

Create a new `PivotData` object.

Usage

PivotData$new(parentPivot = NULL)

Arguments

parentPivot

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

Returns

A new `PivotData` object.


Method addData()

Add a data frame to the pivot table, specifying a name that can be used later to easily retrieve it or refer to it.

Usage

PivotData$addData(dataFrame = NULL, dataName = NULL)

Arguments

dataFrame

The data frame to add to the pivot table.

dataName

The name to assign to this data frame in the pivot table. If no name is specified, then the name of the data frame variable will be used.

Returns

No return value.


Method getData()

Retrieve the data frame with the specified name.

Usage

PivotData$getData(dataName = NULL)

Arguments

dataName

The name that was assigned to the data frame when it was added to the pivot table.

Returns

A data frame.


Method isKnownData()

Check if a data frame exists with the specified name.

Usage

PivotData$isKnownData(dataName = NULL)

Arguments

dataName

The name that was assigned to the data frame when it was added to the pivot table.

Returns

`TRUE` if a data frame exists with the specified name, `FALSE` otherwise.


Method addTotalData()

Add pre-calculated totals/aggregate data to the pivot table.

Usage

PivotData$addTotalData(dataFrame = NULL, dataName = NULL, variableNames = NULL)

Arguments

dataFrame

The data frame to add to the pivot table.

dataName

The name of the associated data frame in the pivot table which these totals relate to.

variableNames

A character vector specifying the names of the variables which these totals are grouped by.

Returns

No return value.


Method countTotalData()

Count the number of data frames containing total/aggregate data that exist in the pivot table associated with a specific named data frame.

Usage

PivotData$countTotalData(dataName = NULL)

Arguments

dataName

The name of the associated data frame in the pivot table which these totals relate to.

Returns

The number of total/aggregate data frames that exist in the pivot table associated with the specified data frame name.


Method getTotalData()

Retrieve pre-calculated totals/aggregate data from the pivot table.

Usage

PivotData$getTotalData(dataName = NULL, variableNames = NULL)

Arguments

dataName

The name of the associated data frame in the pivot table which these totals relate to.

variableNames

A character vector specifying the names of the variables which the totals are grouped by.

Returns

A data frame.


Method asList()

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

Usage

PivotData$asList()

Returns

A list of various object properties.


Method asJSON()

Return the contents of this object as JSON for debugging.

Usage

PivotData$asJSON()

Returns

A JSON representation of various object properties.


Method clone()

The objects of this class are cloneable with this method.

Usage

PivotData$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.