Skip to contents

highdir is an R package that provides a unified, backend-agnostic API for building figures with either highcharter (interactive) or ggplot2 (static).

A figure is described once as a hd_spec object and rendered to any supported backend without changing the calling code. Additional presentation settings can be defined through hc_opts object prior to rendering. The package ships with the default to use The Norwegian Directorate of Health (Helsedirektoratet) colour palette, styling and theme. To enhance usability, a Shiny graphical user interface is also included.


Installation

# Install from GitHub
if(!require(remotes)) install.packages("remotes")
remotes::install_github("folkehelsestats/highdir")

# Install from development version (dev branch)
remotes::install_github("folkehelsestats/highdir@dev")

Get started

The simplest way to get started with highdir is by using the built‑in Shiny app. It shows also codes to demonstrate how to use the package programmatically in R. Start the app with:

The app is also available directly through ShinyApps.io at: https://bit.ly/highdir


Supported geometries

Name highcharter type ggplot2 equivalent Extra args
column column geom_col()
ranked_bar column geom_col() vs, aim, char_scale, min_frac
line line / spline geom_line() smooth, dot_size, line_symbols
scatter scatter geom_point() dot_size
arearange arearange geom_ribbon() ymin, ymax
pie pie geom_bar(), coord_polar() inner_size
stacked_column column geom_bar(), facet_wrap() stack, stacking

To see complete list of extra arguments for specify geoms use:

geom_args("ranked_bar")
geom_args("arearange")

License

MIT © Kamaleri