Generate local flexdashboards for SNAP data sets from package templates.

flex(template, out_dir = getwd(), file = paste0(template, ".html"),
  template_params = NULL, load_static = FALSE, ...)

Arguments

template

character, the ID of the flexdashboard template. See flex_templates for available IDs and descriptions.

out_dir

character, output directory for standalone html document when template refers to a static (non-Shiny) flexdashboard.

file

character, output file name.

template_params

named list, additional parameters passed to a specific template if required. See flex_params for more information.

load_static

logical, load static files automatically. See details.

...

additional arguments passed to flex_dashboard. See details.

Details

This function creates a flexdashboard from an existing template provided by the package. If a given template requires custom arguments to be provided, for example a location name, these arguments can be passed as a named list to template_params.

Some templates produce static documents. Others use Shiny at runtime. Flexdashboards with Shiny backend support automatically launch a local instance in the default web browser. By contrast, the static document templates save the resulting standalone html document to out_dir/<file>, defaulting to the working directory. In this case, load_static = TRUE will toggle on the Shiny-like automatic launch for static flexdashboards. This is off by default.

Note that static does not mean the flexdashboard html document offers no interactivity. A template may still offer the ability to switch between different graphs and tables and explore different content. However, all data is embedded in the document. This makes it useful as a standalone file requiring no Shiny server backend, but it also means that more complex static templates result in larger output file sizes and they cannot achieve anywhere near the complexity of a flexdashboard that uses Shiny.

Additional arguments passed to flex_dashboard typically include theme, css and storyboard. Unless a given template supports it specifically, using storyboard = TRUE will not add any meaningful content. Choice of theme is limited to those available in the flexdashboard package. Additional CSS can be attached with css. Styling contained in a CSS file may be attached remotely via CDN (Content Delivery Network).

See also

flex_templates flex_params

Examples

# NOT RUN {
flex_params("rsds1")
pars <- list(location = "Vancouver")
flex("rsds1", template_params = pars)
flex("rsds1", template_params = pars, theme = "sandstone", storyboard = TRUE)
pars$gfont <- "Source Sans Pro"
pars$snaptheme <- "theme_snap"
flex("rsds1", template_params = pars)
# }