Transforms-class {crunch}R Documentation

Transformations of variable and cube views

Description

Transformations allow you to change how a variable or cube is displayed without changing the underlying data.

Usage

Transforms(..., data = NULL)

TransformsList(..., data = NULL)

transforms(x)

transforms(x) <- value

## S4 method for signature 'CrunchVariable'
transforms(x)

## S4 method for signature 'VariableTuple'
transforms(x)

## S4 replacement method for signature 'CrunchVariable,Transforms'
transforms(x) <- value

## S4 replacement method for signature 'CrunchVariable,'NULL''
transforms(x) <- value

## S4 method for signature 'CrunchCube'
transforms(x)

## S4 method for signature 'VariableCatalog'
transforms(x)

## S4 replacement method for signature 'CrunchCube,ANY'
transforms(x) <- value

## S4 replacement method for signature 'CrunchCube,TransformsList'
transforms(x) <- value

## S4 replacement method for signature 'CrunchCube,'NULL''
transforms(x) <- value

Arguments

...

For the constructor function Transforms you can pass in attributes via ...

data

For the constructor function Transforms you can either pass in attributes via ... or you can create the objects with a fully defined list representation of the objects via the data argument. See the examples.

x

For the attribute getters and setters, an object of class Transforms

value

For the setter, the replacement Transforms to insert

Getting transformations

The transforms(x) methods can be used with Variables and CrunchCubes to get what transformations are currently set. For variables, they return a single Transforms object that includes all transformations for the variable. For CrunchCubes, it returns a named list with the same length as the number of dimensions of the cube with each dimension's transformations.

Currently, Insertions (e.g. Subtotal() and Heading()) are the only type of transformations that are supported.

Setting transformations on a variable

The transforms(x) <- value methods can be used to assign transformations for a specific variable. value must be a Transforms object. This allows you to set transformations on categorical variables. These transformations will automatically show up in any new CrunchCubes that contain this variable.

Setting transformations on a CrunchCube

The transforms(x) <- value methods can also be used to assign transformations to a CrunchCube that has already been calculated. value must be a named list of Transforms objects. The names of this list must correspond to dimensions in the cube (those dimensions correspondences are matched based on variable aliases). You don't have to provide an entry for each dimension, but any dimension you do provide will be overwritten fully.

Removing transformations

To remove transformations from a variable or CrunchCube, use transforms(x) <- NULL.


[Package crunch version 1.30.4 Index]