You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
boB Rudis 625dfce01a
initial commit
1 week ago
R initial commit 1 week ago
inst initial commit 1 week ago
man initial commit 1 week ago
tests R package repo initialization complete 1 week ago
.Rbuildignore initial commit 1 week ago
.codecov.yml R package repo initialization complete 1 week ago
.gitignore R package repo initialization complete 1 week ago
.travis.yml R package repo initialization complete 1 week ago
CONDUCT.md R package repo initialization complete 1 week ago
DESCRIPTION initial commit 1 week ago
LICENSE initial commit 1 week ago
LICENSE.md initial commit 1 week ago
NAMESPACE initial commit 1 week ago
NEWS.md R package repo initialization complete 1 week ago
README.Rmd initial commit 1 week ago
README.md initial commit 1 week ago
imago.Rproj R package repo initialization complete 1 week ago

README.md

Signedby Linux buildStatus
Minimal RVersion License

imago

Hacky World Map GeoJSON Based on the Imago Projection

Description

In 2017, Justin Kunimune reverse engineerd (https://kunimune.home.blog/2017/11/23/the-secrets-of-the-authagraph-revealed/) and open sourced the proprietary AuthaGraph (http://www.authagraph.com/top/?lang=en) projection. Tools are provided to use this map in R for making global choropleth charts.

What’s Inside The Tin

The following functions are implemented:

Installation

remotes::install_git("https://git.rud.is/hrbrmstr/imago.git")
# or
remotes::install_git("https://git.sr.ht/~hrbrmstr/imago")
# or
remotes::install_gitlab("hrbrmstr/imago")
# or
remotes::install_bitbucket("hrbrmstr/imago")

NOTE: To use the ‘remotes’ install options you will need to have the {remotes} package installed.

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")
## [1] '0.1.0'
plot(imago())
## Reading layer `imago-final' from data source `/Library/Frameworks/R.framework/Versions/3.6/Resources/library/imago/geojson/imago-final.geojson' using driver `GeoJSON'
## Simple feature collection with 401 features and 1 field
## geometry type:  GEOMETRY
## dimension:      XY
## bbox:           xmin: -121.9723 ymin: 37.37338 xmax: -121.969 ymax: 37.37454
## epsg (SRID):    4326
## proj4string:    +proj=longlat +datum=WGS84 +no_defs

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

Lang # Files (%) LoC (%) Blank lines (%) # Lines (%)
Rmd 1 0.25 43 0.83 22 0.92 34 0.61
R 3 0.75 9 0.17 2 0.08 22 0.39

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.