R/dimension-transforms.R
makeDimTransform.Rd
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
makeDimTransform(
colors = NULL,
hide = NULL,
rename = NULL,
order = NULL,
name = NULL,
description = NULL,
...
)
A crunch AnalyticPalettes
(palettes()
) or a vector of color RGB hex color
codes that will be used for the color of graphs in the dashboard (used in the order of
appearance of categories/subvariables).
A vector of category names/ids or subvariable names/aliases to hide from display
A named vector of category names/ids or subvariable names/aliases to override their default values
A vector of category names/ids or subvariable names/aliases to override the default ordering of the dimension.
A name for the dimension, overrides the variable's name
A description for the dimension, overrides the variable's description
Other arguments, passed directly to the API for future expansion
if (FALSE) {
# 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"))
)
}