Description Usage Arguments Examples
Helper to transform data frame for treemap/sunburst highcharts format
1 2 3 4 5 6 | data_to_hierarchical(
data,
group_vars,
size_var,
colors = getOption("highcharter.color_palette")
)
|
data |
data frame containing variables to organize each level of the treemap. |
group_vars |
Variables to generate treemap levels. |
size_var |
Variable to aggregate. |
colors |
Color to chart every item in the first level. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
library(dplyr)
data(gapminder, package = "gapminder")
gapminder_2007 <- gapminder::gapminder %>%
filter(year == max(year)) %>%
mutate(pop_mm = round(pop / 1e6))
dout <- data_to_hierarchical(gapminder_2007, c(continent, country), pop_mm)
hchart(dout, type = "sunburst")
hchart(dout, type = "treemap")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.