For a specified polygon file, extract the three digit ID. It is expected that the polygon file has the name format "mh_030_polygon.shp". The function is vectorised it can be used for single or multiple values.

extract_id(filepath)

Arguments

filepath

a filepath or file name of a shapefile

Examples

extract_id("mh_030_polygon.shp")
#> [1] 30
extract_id("polygons/mh_030_polygon.shp")
#> [1] 30
extract_id(c("polygons/mh_030_polygon.shp", "mh_031_polygon.shp"))
#> [1] 30 31