makeDimTransform {crunch} | R Documentation |
Helper for creating slide dimension transformations for dashboards and exports
Description
When displayed in a Crunch Dashboard or exported, crunch slides can have transformations
that customize their display. This is a helper to form the correct data structure for
the functions newSlide()
for setting the transformation directly. For more details see the
API documentation
Usage
makeDimTransform(
colors = NULL,
hide = NULL,
rename = NULL,
order = NULL,
name = NULL,
description = NULL,
...
)
Arguments
colors |
A crunch |
hide |
A vector of category names/ids or subvariable names/aliases to hide from display |
rename |
A named vector of category names/ids or subvariable names/aliases to override their default values |
order |
A vector of category names/ids or subvariable names/aliases to override the default ordering of the dimension. |
name |
A name for the dimension, overrides the variable's name |
description |
A description for the dimension, overrides the variable's description |
... |
Other arguments, passed directly to the API for future expansion |
Examples
## Not run:
# Hiding an element
transforms(slide) <- list(rows_dimension = makeDimTransform(hide = "Neutral"))
# Using an existing saved palette
transforms(slide) <- list(rows_dimension = makeDimTransform(
colors = defaultPalette(ds)
))
# Setting specific colors
transform(slide) <- list(rows_dimension = makeDimTransform(
colors = c("#af8dc3", "#f7f7f7", "#7fbf7b")
))
# Reordering & renaming elements
transforms(slide) <- list(
rows_dimension = makeDimTransform(
rename = c("V. Good" = "Very Good", "V. Bad" = "Very Bad"),
order = 5:1
),
columns_dimension = makeDimTransform(order = c("Brand X", "Brand A", "Brand B"))
)
## End(Not run)