Learn R Programming

crunch (version 1.30.4)

makeDimTransform: 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 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).

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

Run this code
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"))
)
}

Run the code above in your browser using DataLab