Insertions-class {crunch} | R Documentation |
Insert categories in transformations
Description
Insertions allow you to insert new categories into a categorical-like response on a variable's transformations.
Usage
Insertions(..., data = NULL)
Insertion(...)
.Insertion(..., data = NULL)
anchor(x, ...)
anchors(x)
anchor(x) <- value
arguments(x, ...)
arguments(x) <- value
func(x)
funcs(x)
## S4 replacement method for signature 'Insertion'
anchor(x) <- value
## S4 replacement method for signature 'Subtotal'
anchor(x) <- value
## S4 replacement method for signature 'Heading'
anchor(x) <- value
## S4 replacement method for signature 'SummaryStat'
anchor(x) <- value
## S4 replacement method for signature 'Insertion,ANY'
subtotals(x) <- value
## S4 replacement method for signature 'Insertion'
arguments(x) <- value
## S4 replacement method for signature 'Subtotal'
arguments(x) <- value
## S4 replacement method for signature 'Heading'
arguments(x) <- value
## S4 replacement method for signature 'SummaryStat'
arguments(x) <- value
## S4 method for signature 'Insertion'
arguments(x)
## S4 method for signature 'Subtotal'
arguments(x, var_items)
## S4 method for signature 'Heading'
arguments(x)
## S4 method for signature 'SummaryStat'
arguments(x, var_items)
## S4 method for signature 'Insertion'
anchor(x, ...)
## S4 method for signature 'Subtotal'
anchor(x, var_items)
## S4 method for signature 'Heading'
anchor(x, var_items)
## S4 method for signature 'SummaryStat'
anchor(x, var_items)
## S4 method for signature 'Insertion'
func(x)
## S4 method for signature 'Subtotal'
func(x)
## S4 method for signature 'Heading'
func(x)
## S4 method for signature 'SummaryStat'
func(x)
## S4 method for signature 'Insertions'
anchors(x)
## S4 method for signature 'Insertions'
funcs(x)
Arguments
... |
additional arguments to |
data |
For the constructor functions |
x |
For the attribute getters and setters, an object of class Insertion or Insertions |
value |
For |
var_items |
categories (from |
Working with Insertions
Insertions are used to add information about a variable or CrunchCube that extends the data in the dataset but does not alter it. This new data includes: aggregations like subtotals that sum the count of more than on category together or headings which can be added between categories.
Insertions
objects are containers for individual Insertion
objects. The
individual Insertion
s contain all the information needed to calculate,
apply, and display insertions to CrunchCubes and categorical variables.
An Insertion
must have two properties:
-
anchor
- which is the id of the category the insertion should follow -
name
- the string to display
Additionally, Insertions
may also have the following two properties (though
if they have one, they must have the other):
-
function
- the function to use to aggregate (e.g. "subtotal") -
args
- the category ids to use as operands to thefunction
above.
Although it is possible to make both subtotals and headings using Insertion
alone, it is much easier and safer to use the functions
Subtotal() and Heading() instead.
Not only are they more transparent, they also are quicker to type, accept
both category names as well as ids, and have easier to remember argument
names.