
Helper to transform data frame for treemap/sunburst highcharts format
Source:R/helpers.R
data_to_hierarchical.RdHelper to transform data frame for treemap/sunburst highcharts format
Usage
data_to_hierarchical(
data,
group_vars,
size_var,
colors = getOption("highcharter.color_palette")
)Examples
if (FALSE) { # \dontrun{
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")
} # }