crunchBox {crunch} | R Documentation |
Make a CrunchBox
Description
CrunchBoxes allow you to publish results to the world.
Usage
crunchBox(
dataset,
filters = crunch::filters(dataset),
weight = crunch::weight(dataset),
brand_colors,
static_colors,
category_color_lookup,
...
)
CrunchBox(
dataset,
filters = crunch::filters(dataset),
weight = crunch::weight(dataset),
brand_colors,
static_colors,
category_color_lookup,
...
)
Arguments
dataset |
A CrunchDataset, potentially a selection of variables from it |
filters |
FilterCatalog, or |
weight |
a CrunchVariable that has been designated as a potential
weight variable for |
brand_colors |
an optional color vector of length 3 or less, or a named list with names 'primary', 'secondary', and 'message'. See "Details" for more about color specification. |
static_colors |
an optional vector of colors to use for categorical
plots. Bars and lines are colored in the order of |
category_color_lookup |
an optional list of category names to colors to use for that category, wherever it appears in the data. This allows you to always see a category displayed in a specific color. See "Details" for more about color specification. |
... |
additional metadata for the box, such as "title", "header", etc. |
Details
In addition to specifying the variables and filters to include in your
CrunchBox, you can provide custom color palettes. The arguments
brand_colors
, static_colors
, and category_color_lookup
allow you to
provide color lists to use. Colors should be either a valid hexadecimal
string representation, like "#fa1af1", or they may also be an R named color,
such as "darkgreen".
Value
The URL to the newly created box.
See Also
preCrunchBoxCheck()
to provide guidance on what you're including in the
CrunchBox
Examples
## Not run:
# Creating a CrunchBox with three variables
crunchBox(ds[c("var1", "var2", "var3")], title = "New CrunchBox")
# Creating a CrunchBox changing primary, secondary, and message brand colors
crunchBox(ds[c("var1", "var2", "var3")],
title = "Branded CrunchBox",
brand_colors = c("#ff0aa4", "#af17ff", "#260aff")
)
# Creating a CrunchBox changing category-specific colors
crunchBox(ds[c("var1", "var2", "var3")],
title = "CrunchBox with category colors",
category_color_lookup = list(
"agree" = "#ff0aa4",
"disagree" = "#af17ff",
"don't know" = "#260aff"
)
)
## End(Not run)