The `PivotFilter` class represents a single filter condition.
R6Class
object.
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.
variableName
The name of the column in the data frame that this filter applies to.
safeVariableName
The name of the column in the data frame that this filter applies to, surrounded by back-ticks if the name is not legal.
type
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.
values
The subset of values that this filter matches.
new()
Create a new `PivotFilter` object.
PivotFilter$new(parentPivot, variableName = NULL, type = "ALL", values = NULL)
parentPivot
The pivot table that this `PivotFilter` instance belongs to.
variableName
The name of the column in the data frame that this filter applies to.
type
Must 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.
values
A single data value or a vector of multiple data values that this filter will match on.
intersect()
Updates this filter by intersecting the values in this filter with the values from another `PivotFilter` object.
union()
Updates this filter by unioning the values in this filter with the values from another `PivotFilter` object.
replace()
Updates this filter by replacing the values in this filter with the values from another `PivotFilter` object.
asString()
Return a representation of this object as a character value.
pt <- PivotTable$new()
# ...
PivotFilter$new(pt, variableName="Country", values="England")
#> <PivotFilter>
#> Public:
#> asJSON: function ()
#> asList: function ()
#> asString: function (includeVariableName = TRUE, seperator = " ")
#> clone: function (deep = FALSE)
#> getCopy: function ()
#> initialize: function (parentPivot, variableName = NULL, type = "ALL", values = NULL)
#> intersect: function (filter)
#> replace: function (filter)
#> safeVariableName: active binding
#> type: active binding
#> union: function (filter)
#> values: active binding
#> variableName: active binding
#> Private:
#> p_parentPivot: PivotTable, R6
#> p_safeVariableName: Country
#> p_type: VALUES
#> p_values: England
#> p_variableName: Country