| PivotFilter {pivottabler} | R Documentation |
R6 class that defines a filter condition.
Description
The 'PivotFilter' class represents a single filter condition.
Format
R6Class object.
Details
The filter condition represented by a 'PivotFilter' instance relates to one data frame variable/column and is of the form [ColumnName] IN c(Value1, Value2, Value3, ...). Often in a pivot table, each filter specifies only one data value, as typically each distinct data value exists in a separate row or column. The 'PivotFilter' class contains methods to perform set based operations on filter values when combining filters.
Active bindings
variableNameThe name of the column in the data frame that this filter applies to.
safeVariableNameThe name of the column in the data frame that this filter applies to, surrounded by back-ticks if the name is not legal.
typeEither "ALL", "VALUES" or "NONE". "VALUES" is the most common type and means the data is filtered to a subset of values. "ALL" means there is no filtering, i.e. all values match. "NONE" means there can be no matching values/data.
valuesThe subset of values that this filter matches.
Methods
Public methods
Method new()
Create a new 'PivotFilter' object.
Usage
PivotFilter$new(parentPivot, variableName = NULL, type = "ALL", values = NULL)
Arguments
parentPivotThe pivot table that this 'PivotFilter' instance belongs to.
variableNameThe name of the column in the data frame that this filter applies to.
typeMust be either "ALL", "VALUES" or "NONE". "VALUES" is the most common type and means the data is filtered to a subset of values. "ALL" means there is no filtering, i.e. all values match. "NONE" means there can be no matching values/data.
valuesA single data value or a vector of multiple data values that this filter will match on.
Returns
A new 'PivotFilter' object.
Method intersect()
Updates this filter by intersecting the values in this filter with the values from another 'PivotFilter' object.
Usage
PivotFilter$intersect(filter)
Arguments
filterA 'PivotFilter' object.
Returns
No return value.
Method union()
Updates this filter by unioning the values in this filter with the values from another 'PivotFilter' object.
Usage
PivotFilter$union(filter)
Arguments
filterA 'PivotFilter' object.
Returns
No return value.
Method replace()
Updates this filter by replacing the values in this filter with the values from another 'PivotFilter' object.
Usage
PivotFilter$replace(filter)
Arguments
filterA 'PivotFilter' object.
Returns
No return value.
Method getCopy()
Create a copy of this 'PivotFilter' object.
Usage
PivotFilter$getCopy()
Returns
A copy of this 'PivotFilter' object.
Method asList()
Return the contents of this object as a list for debugging.
Usage
PivotFilter$asList()
Returns
A list of various object properties.
Method asJSON()
Return the contents of this object as JSON for debugging.
Usage
PivotFilter$asJSON()
Returns
A JSON representation of various object properties.
Method asString()
Return a representation of this object as a character value.
Usage
PivotFilter$asString(includeVariableName = TRUE, seperator = " ")
Arguments
includeVariableName'TRUE' (default) to include the variable name in the string.
seperatorA character value used when concatenating multiple filter values.
Returns
A character summary of various object properties.
Method clone()
The objects of this class are cloneable with this method.
Usage
PivotFilter$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
pt <- PivotTable$new()
# ...
PivotFilter$new(pt, variableName="Country", values="England")