knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%", warning = FALSE, message = FALSE, error = TRUE, cache = FALSE )
# Generate hex sticker # On linux, there are some non-R prerequistes: # - sudo apt install libmagick++-dev # - https://tecadmin.net/install-imagemagick-on-linux/ library(hexSticker) library(ggplot2) library(extrafont) extrafont::loadfonts(quiet = TRUE) p <- ggplot(data = data.frame(x = 1:100, y = jitter((1:100)^2, factor = 5000)), aes(x = x, y = y)) + geom_point(alpha = 0.6, color = 'darkorange', size = 1) p <- p + theme_void() + theme_transparent() sticker(p, package="hefpi", p_family = 'Lato', p_size = 30, s_x=1, s_y=.75, s_width=1.3, s_height=1, p_color = "white", h_color = '#333333', h_fill = "#000000", spotlight = TRUE, filename="man/figures/logo.png")
hefpi
is a web application for the visual exploration of the World Bank's Health Equity and Financial Protection Indicators.
You can install hefpi from github by running the following:
devtools::install_github('databrew/hefpi')
To deploy on a shiny server, simply place an app.R
file in a folder as one normally would do, and populate that file with the following lines:
library(hefpi) run_app()
When re-deploying, you won't need to re-do the above. But you will need to remove the previous iteration of the app, reinstall, and restart the shiny server.
sudo su - -c "R -e \"remove.packages('hefpi')\"" sudo su - -c "R -e \"devtools::install_github('databrew/hefpi', dependencies = TRUE, force = TRUE)\"" sudo systemctl restart shiny-server
The HEFPI dashboard is structured as a R package (created with golem https://cran.r-project.org/web/packages/golem/vignettes/a_start.html)
The primary files:
- dev/run_dev.R
: The code you'll use to run the app locally after making changes
- inst/app/www/*: logos, fonts, and the
custom.cssfile that controls the CSS for the app.
-
misc/guide.md: AWS admin guide for setting up shiny app.
-
data-raw/from_other/-
data-raw/from_wb/-
data-raw/from_website/-
data-raw/raw_data.R-
data/-
R/app_config.R: Used to read insdie golem config file
inst/golem-config.yml-
R/app_ui.R: all ui modules (top level)
-
R/app_server.R: all server side modules (top level)
-
R/mod_dat.R:
- Data availability by country
- Data availability by indicator
-
R/mod_trends.R- Trends national mean
- Trends subnational mean
- Trends concentration index
- Trends quintiles
-
R/mod_recent.R- Most recent value national mean
- Most recent value concentration index
-
R/mod_recent_sub.R- Most recent value subnational mean
-
R/mod_dots.R- Quintiles by country
- Quintiles by indicator
-
R/plot_theme_new.R`: plot theme function
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.