The `PivotCell` class represents a cell in the body of a pivot table (i.e. not a row/column heading, rather a cell typically containing a numerical value).

Format

R6Class object.

Active bindings

instanceId

An integer value that uniquely identifies this cell. NB: This number is guaranteed to be unique within the pivot table, but the method of generation of the values may change in future, so you are advised not to base any logic on specific values.

rowNumber

The row number of the cell. 1 = the first (i.e. top) data row.

columnNumber

The column number of the cell. 1 = the first (i.e. leftmost) data column.

calculationName

The name of the calculation that is displayed in the cell.

calculationGroupName

The name of the calculation group that owns the calculation.

isEmpty

`TRUE` if this cell contains no data (e.g. if it is part of a header / outline row), `FALSE` otherwise.

rowFilters

A `PivotFilters` object containing the filters applied to this cell from the row data groups (i.e. row headings).

columnFilters

A `PivotFilters` object containing the filters applied to this cell from the column data groups (i.e. column headings).

rowColFilters

A `PivotFilters` object containing the combined filters applied to this cell from both the row and column data groups.

calculationFilters

The set of filters that apply to this cell to support calculation logic. Either a `PivotFilters` object or a `PivotFilterOverrides` object. See the "Appendix: Calculations" vignette for details.

workingData

A list of filter objects that results when the `rowColFilters` and `calculationFilters` are combined prior to calculating the cell value. This is a list since some cells involve multiple calculations - where `calc$type` is "calculation" or "function", the calculation can be based on the values of other calculations.

evaluationFilters

The same as `workingData` generally, except when custom calculation functions modify the filters whilst executing.

rowLeafGroup

The row data group linked to this row.

columnLeafGroup

The column data group linked to this column.

isTotal

`TRUE` is this cell is a total, `FALSE` otherwise-

rawValue

The raw cell value - i.e. unformatted, typically a numeric value.

formattedValue

The formatted value - typically a character value.

baseStyleName

The name of the style that defines the visual appearance of the cell.

style

A `PivotStyle` object that assists in managing the CSS style declarations that override the base style.

Methods

Public methods


Method new()

Create a new `PivotCell` object.

Usage

PivotCell$new(
  parentPivot,
  rowNumber = NULL,
  columnNumber = NULL,
  calculationName = NULL,
  calculationGroupName = NULL,
  isEmpty = FALSE,
  rowFilters = NULL,
  columnFilters = NULL,
  rowColFilters = NULL,
  rowLeafGroup = NULL,
  columnLeafGroup = NULL
)

Arguments

parentPivot

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

rowNumber

The row number of the cell. 1 = the first (i.e. top) data row.

columnNumber

The column number of the cell. 1 = the first (i.e. leftmost) data column.

calculationName

The name of the calculation that is displayed in the cell.

calculationGroupName

The name of the calculation group that owns the calculation.

isEmpty

`TRUE` if this cell contains no data (e.g. if it is part of a header / outline row), `FALSE` otherwise.

rowFilters

A `PivotFilters` object containing the filters applied to this cell from the row data groups (i.e. row headings).

columnFilters

A `PivotFilters` object containing the filters applied to this cell from the column data groups (i.e. column headings).

rowColFilters

A `PivotFilters` object containing the combined filters applied to this cell from both the row and column data groups.

rowLeafGroup

The row data group linked to this row.

columnLeafGroup

The column data group linked to this column.

Returns

A new `PivotCell` object.


Method setStyling()

An internal method used to set style declarations on the cell. Using `pt$setStyling(cells=x)` is preferred for users.

Usage

PivotCell$setStyling(styleDeclarations = NULL)

Arguments

styleDeclarations

A list containing CSS style declarations.

Returns

No return value.


Method getCopy()

Non-functional legacy method soon to be removed.

Usage

PivotCell$getCopy()

Returns

Returns an empty list.


Method asList()

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

Usage

PivotCell$asList()

Returns

A list of various object properties.


Method asJSON()

Return the contents of this object as JSON for debugging.

Usage

PivotCell$asJSON()

Returns

A JSON representation of various object properties.


Method clone()

The objects of this class are cloneable with this method.

Usage

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