6.1 Packages

  • rnaturalearth (boundaries)
  • geodata (climate, elevation, land use, soil, crop, species occurrence, administrative boundaries, and other data)
  • chirps (daily high-resolution precipitation, as well as daily maximum and minimum temperatures)
  • elevatr (elevation data from Amazon Web Services)
  • osmdata (roads, shops, railway stations, and much more)
  • wbstats (global socio-economic data spanning several decades)
  • spocc (species occurrence data sources including Global Biodiversity Information)
  • wopr (estimates of population sizes for specific geographic areas)
  • rdhs (Demographic and Health Survey (DHS))
  • malariaAttlas (global malaria data)
  • openair (air quality data and other atmospheric composition data)
  • spatstat (point pattern data)
  • spData (includes diverse spatial datasets )
  • ggmap (geocode place names or addresses)
  • opencage (convert names to geographic coordinates)
  • tidycensus
  • tigris
  • mapSpain
  • goebr
  • giscoR

6.1.1 Example with rnaturalearth

# install.packages("devtools")
# devtools::install_github("ropensci/rnaturalearthhires")

library(rnaturalearth)
library(sf)
library(ggplot2)
library(viridis)
library(patchwork)

map1 <- ne_countries(type = "countries", 
                     country = "Germany",
                     scale = "medium", 
                     returnclass = "sf")
map2 <- rnaturalearth::ne_states("Germany", 
                                 returnclass = "sf")
p1 <- ggplot(map1) + geom_sf()
p2 <- ggplot(map2) + geom_sf()
p1 + p2