Skip to content

UNHCR-WEB/unhcRstyle

 
 

Repository files navigation

Content

A package with all necessary elements to quickly implement UNHCR Brand style in your statistical products and data stories:

  1. Adjusted ggplot2 themes for:

    • bar chart,
    • scatter plot,
    • histogram and
    • maps
  2. A series of color palette for:

    • Discrete palette with either fixed or dynamically extended number of shades
    • Discrete palette with specific values for "good", "bad", and "neutral"
    • Continuous diverging color palette
    • Continuous color palette
  3. Different Rmarkdown __template __ to quick-start any report or slides you need to prepare:

    • Paginated report built on the top of pagedown. You can see an example through the default template and the UNHCR R Cookbook
    • Analysis Repository contribution
    • Word with UNHCR style
    • Powerpoint with UNHCR style
    • html/bootstrap -scroll-able report
    • html/slide - slide-able report

Usage

First make sure to have all your fonts - and specifically Lato - registered with R

# install.packages("extrafont")
library(extrafont)
font_import()
extrafont::loadfonts(device="postscript")

# install.packages('showtext', dependencies = TRUE)
library(showtext)

# Check the current search path for fonts
allfontpath <- font_paths()    

# List available font files in the search path
allfont <- font_files()    

# syntax: font_add(family = "<family_name>", regular = "/path/to/font/file")
font_add("Lato", "Lato-Regular.ttf")

font_families()
## automatically use showtext for new devices
showtext_auto() 

Then, install this package from Github:

remotes::install_github('unhcr-web/unhcRstyle')

Once the package installed, you should be able to create directly your report with the right template within Rstudio:

preview

This package requires a recent version of Pandoc (>= 2.2.3). If you use RStudio, you are recommended to install the latest version (>= 1.2.1335), which has bundled Pandoc 2.x, otherwise you need to install Pandoc separately.

This package is part of unhcrverse, a set of packages to ease the production of statistical evidence and data stories. You can install them all with the following:

## Use UNHCR Open data  - https://unhcr.github.io/unhcrdatapackage/docs/
remotes::install_github('unhcr/unhcrdatapackage')

## API to connect to internal data source - https://unhcr-web.github.io/hcrdata/docs/
remotes::install_github('unhcr-web/hcrdata')

## Perform High Frequency Check https://unhcr.github.io/HighFrequencyChecks/docs/
remotes::install_github('unhcr/HighFrequencyChecks')

## Process data crunching for survey dataset - https://unhcr.github.io/koboloadeR/docs/
remotes::install_github('unhcr/koboloadeR')

## Use UNHCR graphical template- https://unhcr-web.github.io/unhcRstyle/docs/
remotes::install_github('unhcr-web/unhcRstyle')

Building package documentation

devtools::document()

devtools::check(document = FALSE)

pkgdown::build_site()

If you encounter a clear bug, please file a minimal reproducible example on github.

References / Inspiration