Day 8: globe4r

Welcome back for the 8th day of the #packagecalendar, The package of the day is globe4r created by John (JP) Coene. The globe4r package wraps the globe.gl library.

The package is not yet on CRAN and can be downloaded from Github with

remotes::install_github("JohnCoene/globe4r")

The package is wonderfully simple. Simply start by calling create_globe(). This will create a blank canvas with a globe on it.

library(globe4r)
create_globe()

it is interactive so you can zoom and drag as you wish.

Let’s play around a little bit and load in some population data. Population data is very important for Santa when we need to plan his route.

data("population") # comes with globe4r

Let’s take our globe we created with create_globe() and add some bars. This is done in much the same way as in ggplot2.

create_globe() %>%
  globe_bars(
    coords(lat, lon, altitude = value),
    data = population
  ) %>% 
  scale_bars_altitude(max = 0.4)