I want to automatically create two variables from a shape file: 1. a dummy indicator for if a region has a international border and 2. a dummy indicator for if a region has a coastal border.
For example for Guinea variable 1 would be the regions with red dots below, and variable 2 would be with blue dots (I did these by eye).
library(raster)
sd0 <- getData(name = "GADM", country = "GIN", level = 2)
plot(sd0)
There does not seem to be any information in the @data
slot for these type of characteristics:
head(sd0@data)
# OBJECTID ID_0 ISO NAME_0 ID_1 NAME_1 ID_2 NAME_2 HASC_2 CCN_2 CCA_2 TYPE_2 ENGTYPE_2 NL_NAME_2
# 1 1 97 GIN Guinea 1 Boké 1 Boffa GN.BF NA Préfecture Prefecture
# 2 2 97 GIN Guinea 1 Boké 2 Boké GN.BK NA Préfecture Prefecture
# 3 3 97 GIN Guinea 1 Boké 3 Fria GN.FR NA Préfecture Prefecture
# 4 4 97 GIN Guinea 1 Boké 4 Gaoual GN.GA NA Préfecture Prefecture
# 5 5 97 GIN Guinea 1 Boké 5 Koundara GN.KD NA Préfecture Prefecture
# 6 6 97 GIN Guinea 2 Conakry 6 Conakry GN.CK NA Préfecture Prefecture
Perhaps they are elsewhere (I have little to no experience with shape files)? Is there a function somewhere that could at least allow me to create a variable that indicates if a region has no outer boundaries (i.e. all those with no dots in the map above)?