small african spatial datasets for learning & teaching mapping in R
# afrilearndata
afrilearndata provides small African spatial datasets to help with
learning and teaching of spatial techniques and mapping.
The motivation is to provide analysts based in Africa with more easily
relateable example datasets. More generally we aim to support the growth
of R and mapping in the continent. Part of the
afrimapr project
providing R building blocks, training and community.
## Installation
Install the development version of afrilearndata with:
``` r
# install.packages("remotes") # if not already installed
remotes::install_github("afrimapr/afrilearndata")
library(afrilearndata)
```
## Datasets
The package contains the following objects
1. `africontinent` polygons, continent outline including madagascar
2. `africountries` polygons, 51 country boundaries
3. `afrihighway` lines, trans African highway network (100 lines)
4. `africapitals` points, 51 capital cities
5. `afriairports` points, \>3000 African airports
6. `afripop2020` raster grid, population density 2020 from
WorldPop aggregated to 20km squares
7. `afripop2000` raster grid, population density 2000 from
WorldPop aggregated to 20km squares
8. `afrilandcover` raster grid, landcover in 2019, categorical, 20km
from MODIS
Lazy loading means that the objects should be accessible once
`library(afrilearndata)` is used.
If they are not recognised you can use e.g. `data(africountries)` to
make sure the objects are loaded.
As well as providing the data as R objects the package provides them as
files that can be used to demonstrate the process of reading spatial
data into R and the read code is provided in the documentation of each
dataset. The different datasets cover the following formats commonly
used to store sptial data : geopackage, shapefile, kml, tiff, csv and
grd.
Firstly, here are most of the data shown together. The `tmap` code to
create this plot is shown later in the readme.
Now looking at the data layers individually plotted with packages `sf`
or `raster` …