Skip to contents

Retrieves Shape data from the shared drive.

Usage

get_shapes(version_date = NULL, source = "polio", layer = "admin2", latest = T)

Arguments

version_date

A string in the format of "yyyy-mm", corresponding to the version of the shape file you wish to load.

source

A string used to determine which shape file to load. Options are: "polio" and "gadm".

layer

A string used to determine which layer to load. Options are: "admin0", "admin1", and "admin2"

latest

Defaults to TRUE. If loading polio shapes, this ensures you only use the latest shape version for each country for a given version_date. If set to FALSE, you will load the file which has all shape file versions available for a given version date.

Value

A sf object

Examples


# Defaults are set to polio, admin2, and latest shape version,
# So you can just provide version_date:
get_shapes("2022-03")
#> Reading in Polio admin2 shape file dated: 2022-03
#> Error: Cannot open "C:/Users//Gavi/Measurement, Evaluation and Learning - Documents/CPMM/Datasets/Shapes/Polio/2022-03/outputs/polio_shapes_latest_2022-03.gpkg"; The file doesn't seem to exist.

# Note for GADM, no version date needed
get_shapes(source = "gadm")
#> Reading in GADM admin2 shape file
#> Error: Cannot open "C:/Users//Gavi/Measurement, Evaluation and Learning - Documents/CPMM/Datasets/Shapes/GADM/gadm_shapes.gpkg"; The file doesn't seem to exist.

# can also add arguments to override defaults
get_shapes("2022-03", layer = "admin1", latest = FALSE)
#> Reading in Polio admin1 shape file dated: 2022-03
#> Error: Cannot open "C:/Users//Gavi/Measurement, Evaluation and Learning - Documents/CPMM/Datasets/Shapes/Polio/2022-03/outputs/polio_shapes_2022-03.gpkg"; The file doesn't seem to exist.