Package 'afrilearndata'

Title: Small Africa Map Datasets for Learning
Description: Small African datasets to help with learning and teaching of spatial techniques and mapping. Part of afrimapr project. To provide analysts based in Africa with more easily relateable example datasets. R objects for points, lines, polygons and raster. Source files including .gpkg, .shp, .kml, .tif, .grd, .csv.
Authors: Andy South [aut, cre] , Chris Littleboy [ctb] , Shelmith Kariuki [ctb]
Maintainer: Andy South <[email protected]>
License: CC0
Version: 0.0.0.9003
Built: 2024-10-27 05:05:08 UTC
Source: https://github.com/afrimapr/afrilearndata

Help Index


African airports

Description

a sf object points of African airports. See data-raw/afrilearndata-creation.R for how the data object is created.

Usage

afriairports

Format

Formal class 'sf'; 50 rows 5 columns

  • id id numeric

  • ident ident XXXX

  • type large_airport medium_airport small_airport

  • name airport name

  • elevation_ft elevation in feet

  • continent continent code AF

  • country_name country name

  • iso_country country code two letters capitalised

  • region_name name of region

  • iso_region iso region code incl country XX-YY

  • local_region region code excl country YY

  • municipality municipality

  • scheduled_service scheduled_service 1=yes, 2=no

  • gps_code gps charecter code

  • iata_code iata character code

  • local_code local code

  • home_link web page url

  • wikipedia_link wikipedia url

  • keywords keywords

  • score score

  • last_updated last update

  • geometry coordinates of the point sfc_POINT

Geographical coordinates WGS84 datum (CRS EPSG 4326)

Source

https://ourairports.com/continents/AF/airports.csv

Examples

if (requireNamespace("sf", quietly = TRUE)) {
  library(sf)
  data(afriairports)

  # or read from the csv file which is stored in package as example to work with
  # filename <- system.file("extdata","afriairports.csv", package="afrilearndata", mustWork=TRUE)
  # dfairports <- readr::read_csv(filename)
  # and convert to sf object
  # afriairports <- sf::st_as_sf(dfairports, coords=c("longitude_deg", "latitude_deg"), crs=4326)

  #plot(sf::st_geometry(afriairports))
}

African capital city points

Description

a sf object points of African capital cities See data-raw/afrilearndata-creation.R for how the data object is created.

Usage

africapitals

Format

Formal class 'sf'; 50 rows 5 columns

  • capitalname character vector capital city names

  • countryname character vector country names

  • pop numeric estimated population 2006

  • iso3c character vector ISO 3 letter country code

  • geometry sfc_POINT

Geographical coordinates WGS84 datum (CRS EPSG 4326)

Source

https://cran.r-project.org/web/packages/maps/

Examples

if (requireNamespace("sf", quietly = TRUE)) {
  library(sf)
  data(africapitals)
  # or
  filename <- system.file("extdata","africapitals.gpkg", package="afrilearndata", mustWork=TRUE)
  africapitals <- sf::read_sf(filename)

  #plot(sf::st_geometry(africapitals))
}

African country boundaries

Description

a sf object containing low resolution African continent outline See data-raw/afrilearndata-creation.R for how the data object is created.

Usage

africontinent

Format

Formal class 'sf';

  • name character vector continent name

  • geometry sfc_MULTIPOLYGON

Geographical coordinates WGS84 datum (CRS EPSG 4326)

Source

https://www.naturalearthdata.com/downloads/110m-cultural-vectors/

See Also

https://cran.r-project.org/web/packages/rnaturalearth/

Examples

if (requireNamespace("sf", quietly = TRUE)) {
  library(sf)
  data(africontinent)
  # or
  filename <- system.file("extdata","africontinent.shp", package="afrilearndata", mustWork=TRUE)
  africontinent <- sf::read_sf(filename)

  plot(sf::st_geometry(africontinent))
}

African country boundaries

Description

a sf object containing low resolution African country boundaries See data-raw/afrilearndata-creation.R for how the data object is created.

Usage

africountries

Format

Formal class 'sf'; 51 rows, 8 columns

  • name character vector country names

  • name_long character vector country names long

  • pop_est numeric estimated population

  • gdp_md_est numeric estimated gdp

  • lastcensus numeric year of last census

  • income_grp character vector income group

  • iso_a3 character vector ISO 3 letter country code

  • geometry sfc_MULTIPOLYGON

  • name_fr character vector French country names

  • name_pt character vector Portuguese country names

  • name_af character vector Afrikaans country names

  • name_sw character vector Swahili country names

Geographical coordinates WGS84 datum (CRS EPSG 4326)

Source

https://www.naturalearthdata.com/downloads/110m-cultural-vectors/

See Also

https://cran.r-project.org/web/packages/rnaturalearth/

Examples

if (requireNamespace("sf", quietly = TRUE)) {
  library(sf)
  data(africountries)
  # or
  filename <- system.file("extdata","africountries.shp", package="afrilearndata", mustWork=TRUE)
  africountries <- sf::read_sf(filename)#'
  plot(sf::st_geometry(africountries))
}

African trans-continental highway network lines

Description

a sf object of simplified lines of transcontinental highway network See data-raw/afrilearndata-creation.R for how the data object is created.

Usage

afrihighway

Format

Formal class 'sf'; 100 rows, 2 columns

  • Name character vector of section names

  • geom sfc_LINESTRING

Geographical coordinates WGS84 datum (CRS EPSG 4326)

Source

https://www.google.com/maps/d/u/0/viewer?msa=0&mid=1nEU2oBFzSxabx3Z14nTyZP3KSzY&ll=1.9249940151081273%2C12.874260000000021&z=3

See Also

https://en.wikipedia.org/wiki/Trans-African_Highway_network

Examples

if (requireNamespace("sf", quietly = TRUE)) {
  library(sf)
  data(afrihighway)
  # or
  filename <- system.file("extdata","trans-african-highway.kml",
                          package="afrilearndata", mustWork=TRUE)
  afrihighway <- sf::read_sf(filename)
  #remove Description column, only has contents in first row
  afrihighway <- afrihighway[ , which(names(afrihighway)!='Description')]

  plot(sf::st_geometry(afrihighway))
}

landcover raster for Africa, categorical, 20km resolution

Description

a raster object storing the majority landcover in 2019 for all 20km squares in Africa. Categorical, 20km resolution from MODIS. Cell values are numeric, landcover type names are stored in Raster Attribute Table (RAT) that can be accessed via levels(afrilandcover) See data-raw/afrilearndata-creation.R for how the data object is created.

Usage

afrilandcover

Format

Formal class 'raster';

Geographical coordinates WGS84 datum (CRS EPSG 4326)

Source

https://lpdaac.usgs.gov/products/mcd12c1v006/

See Also

Friedl, M., D. Sulla-Menashe. MCD12C1 MODIS/Terra+Aqua Land Cover Type Yearly L3 Global 0.05Deg CMG V006. 2015, distributed by NASA EOSDIS Land Processes DAAC, https://doi.org/10.5067/MODIS/MCD12C1.006. Accessed 2021-06-07.#'

Examples

if (requireNamespace("raster", quietly = TRUE)) {
  library(raster)
  data(afrilandcover)
  # or
  filename <- system.file("extdata","afrilandcover.grd", package="afrilearndata", mustWork=TRUE)
  afrilandcover <- raster::raster(filename)

  plot(afrilandcover)
}

# interactive plotting with mapview
if (requireNamespace("mapview", quietly = TRUE) &
    requireNamespace("rgdal", quietly = TRUE)) {
  library(mapview)
  mapview(afrilandcover,
          att="landcover",
          col.regions=levels(afrilandcover)[[1]]$colour)
}

modelled population density 2000 per square km from WorldPop aggregated to mean per 20km squares

Description

a raster object modelled population density 2000 per square km from WorldPop aggregated to mean per 20km squares

Usage

afripop2000

Format

Formal class 'raster';

Geographical coordinates WGS84 datum (CRS EPSG 4326)

Source

https://www.worldpop.org/geodata/summary?id=24757

See Also

https://www.worldpop.org WorldPop datasets are licensed under Creative Commons Attribution 4.0 International (CC BY 4.0) https://creativecommons.org/licenses/by/4.0/

Examples

if (requireNamespace("raster", quietly = TRUE)) {
  library(raster)
  data(afripop2000)
  # or
  filename <- system.file("extdata","afripop2000.tif", package="afrilearndata", mustWork=TRUE)
  afripop2000 <- raster::raster(filename)

  plot(afripop2000)
}

modelled population density 2020 per square km from WorldPop aggregated to mean per 20km squares

Description

a raster object modelled population density 2020 per square km from WorldPop aggregated to mean per 20km squares See data-raw/afrilearndata-creation.R for how the data object is created.

Usage

afripop2020

Format

Formal class 'raster';

Geographical coordinates WGS84 datum (CRS EPSG 4326)

Source

https://www.worldpop.org/geodata/summary?id=24777

See Also

https://www.worldpop.org WorldPop datasets are licensed under Creative Commons Attribution 4.0 International (CC BY 4.0) https://creativecommons.org/licenses/by/4.0/

Examples

if (requireNamespace("raster", quietly = TRUE)) {
  library(raster)
  data(afripop2020)
  # or
  filename <- system.file("extdata","afripop2020.tif", package="afrilearndata", mustWork=TRUE)
  afripop2020 <- raster::raster(filename)

  plot(afripop2020)
}