Description Usage Arguments Examples
Make a .html dashboard. Key required inputs are datasets with 1. data 2. variable interpretations, labels and details 3. other text to be passed as arguments
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | dashdash(
output_file,
my_vars,
my_data,
my_args,
my_blog = NULL,
title = NULL,
group = NULL,
subtitle = NULL,
author = NULL,
trend = list("daily"),
add_maps = NULL,
map_path = NULL,
map_region = NULL,
map_layer = NULL,
scale_vars = NULL,
pd_width = 0.1,
switch = NULL,
ft_plot = NULL,
country_code = NULL,
...
)
|
output_file |
Path to where ouutput should be written, e.g. "docs/index.html" |
my_vars |
dataframe with mapping from variable names to variable families and labels. One row per variable. |
my_data |
dataframe with data on variables listed in 'my_vars'. Should contain a 'id' variable that connects with units in map files and a 'date' variable. |
my_args |
dataframe with arguments to customize a dashboard. |
my_blog |
data frame with blog entries. |
title |
Dashboard title |
subtitle |
Dashboard subtitle |
author |
String, names of authors. |
trend |
List. "daily" for high-frequency daily plots or "moving_average" for 3 day moving average. |
add_maps |
Option to add a map tab |
map_path |
String, path to map shapefiles. |
map_region |
String, map region. |
map_layer |
String, map layer. |
scale_vars |
Logical. Whether to scale_vars variabels before map plotting. |
pd_width |
position dodge argument for graphing aesthetics |
switch |
ggplot2 argument: By default, the labels are displayed on the top and right of the plot. If "x", the top labels will be displayed to the bottom. If "y", the right-hand side labels will be displayed to the left. Can also be set to "both". |
ft_plot |
Add a Financial Times type plot |
country_code |
three letter country code used for Financial Times plot |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | library(dplyr)
my_data <-
expand_grid(id = c("Bo", "Bombali", "Bonthe"), date = as.Date(c("2020-04-18", "2020-04-19", "2020-04-20"))) %>%
data.frame(stringsAsFactors = FALSE) %>%
mutate(n = 3) %>%
uncount(n) %>%
dplyr::mutate(
market_open = rbinom(n(), 1, .5),
price_rice = rbinom(n(), 1, .5),
aware = rbinom(n(), 1, .5),
water = rbinom(n(), 1, .5))
my_vars <- data.frame(
variable = c("market_open", "price_rice", "aware", "water"),
family = c("Markets", "Markets", "Actions", "Actions"),
short_label = c("Is market open?", "Price of a rice", "Aware of Covid19", "Access to water"),
description = c("details on market open", "Price of a cup of rice", "Details on aware of Covid19", "Details on access to water"),
stringsAsFactors = FALSE
)
my_args <- data.frame(
para = "Intro text",
datanote = "Study specific note about data source",
map_path = "c:/temp/shapefiles",
map_layer = "SLE_adm3",
map_region = "NAME_2",
switch = "y",
stringsAsFactors = FALSE
)
dashdash(output_file = "dashtest.html",
title = "title2",
subtitle = "subtitle here",
my_data = my_data,
my_vars = my_vars,
my_args = my_args)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.