R hrbrthemes package

Yet another great R package by hrbrmstr.

theme_ipsum_rc() #

I’m a huge fan of the theme_ipsum_rc() theme, but it does take a bit of extra work to get the development environment to play nicely with this one.

The main hickup seems to be around how fonts are handled by R and the OS.

The steps necessary to get this to work:

  1. Install the roboto font. On a Mac, use the Font Book.

  2. From R, run system(sprintf("open %s", system.file("fonts", package = "hrbrthemes"))). This pops open a finder window of fonts.

  3. Manually copy the fonts over to ~/Library/Fonts

  4. From R, run extrafont::font_import("~/Library/Fonts")

  5. Wherever you plan to use theme_ipsum_rc(), be sure to run extrafont::loadfonts(quiet = TRUE) at the top.

Whenever there’s a system or R upgrade, be sure to run extrafont::font_import("~/Library/Fonts") again.