hrbrpkghelpr::global_opts()
hrbrpkghelpr::stinking_badges()
hrbrpkghelpr::yank_title_and_description()

What's Inside The Tin

The following functions are implemented:

hrbrpkghelpr::describe_ingredients()

Installation

hrbrpkghelpr::install_block()

NOTE

This is really only suitable for choropleths. You're not going to be able to plot lon/lat on this since it was a hacky conversion from an SVG file to a woefully inaccurate projected GeoJSON, done mostly for a friend.

Usage

library(imago)

# current version
packageVersion("imago")
plot(imago())
library(hrbrthemes)
library(countrycode)
library(tidyverse)

cols(
  .default = col_double(),
  date = col_date(format = "")
) -> covid_cols

read_csv(
  file = "https://covid.ourworldindata.org/data/who/total_cases.csv",
  col_types = covid_cols
) %>% 
  tail(1) %>%
  gather(country, cases, -date) %>%
  filter(!(country %in% c("World", "International", "Saint Barthlemy"))) %>%
  mutate(iso3c = countrycode(country, "country.name", "iso3c")) %>%
  select(-date, -country) -> covid_global

left_join(
  imago(quiet = TRUE, stringsAsFactors = FALSE), 
  covid_global,
  by = "iso3c"
) %>%
  ggplot() +
  geom_sf(
    aes(fill = cases), color = "black", size = 0.25
  ) +
  scale_fill_viridis_c(
    name = "# Cases\n(log10)", na.value = "white",
    direction = -1, trans = "log10", label = scales::comma
  ) +
  coord_sf(datum = NA) +
  labs(title = sprintf("Covid cases as of %s", Sys.Date())) +
  theme_ipsum_es(grid="") +
  theme(legend.key.width = unit(2.5, "lines")) +
  theme(legend.position = "bottom")

imago Metrics

cloc::cloc_pkg_md()

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.



hrbrmstr/imago documentation built on March 22, 2020, 1:14 a.m.