I'm trying to replicate this map:
Unfortunately there aren't any available shapefiles for those regions, but I do know the provinces in each group.
When I run this code, I get:
x <- c("ggmap", "rgdal", "maptools", "dplyr", "tidyr", "tmap", "ggplot2")
lapply(x, library, character.only = TRUE)
setwd("C:\\Users\\Dell\\Desktop\\Regiones de Saud")
library(tidyverse)
library(tmap)
library(dplyr)
library(sf)
library(rgdal)
library(rgeos)
library(lwgeom)
prov <- readOGR("RD_PROV.shp")
prov@data$Region <- NA
prov@data
# Assigning health region to provinces.
#1
prov@data$Region[prov@data$TOPONIMIA %in% c("DISTRITO NACIONAL", "SANTO DOMINGO", "MONTE PLATA")] <- "Region 0"
#2
prov@data$Region[prov@data$TOPONIMIA %in% c("PERAVIA", "SAN CRISTÓBAL", "SAN JOSÉ DE OCOA")] <- "Region I"
#3
prov@data$Region[prov@data$TOPONIMIA %in% c("SANTIAGO", "PUERTO PLATA", "ESPAILLAT")] <- "Region II"
#4
prov@data$Region[prov@data$TOPONIMIA %in% c("DUARTE", "SAMANÁ", "MARÍA TRINIDAD SÁNCHEZ","HERMANAS MIRABAL")] <- "Region III"
# 5
prov@data$Region[prov@data$TOPONIMIA %in% c("INDEPENDENCIA", "BAORUCO", "BARAHONA","PEDERNALES")] <- "Region IV"
# 6
prov@data$Region[prov@data$TOPONIMIA %in% c("LA ALTAGRACIA", "LA ROMANA", "EL SEIBO","SAN PEDRO DE MACORIS","HATO MAYOR")] <- "Region V"
prov@data$Region[prov@data$TOPONIMIA %in% c("AZUA", "SAN JUAN", "ELÍAS PIÑA")] <- "Region VI"
prov@data$Region[prov@data$TOPONIMIA %in% c("DAJABÓN", "MONTE CRISTI", "SANTIAGO RODRIGUEZ","VALVERDE")] <- "Region VII"
prov@data$Region[prov@data$TOPONIMIA %in% c("LA VEGA", "MONSEÑOR NOUEL", "SÁNCHEZ RAMÍREZ")] <- "Region VIII"
tm_shape(prov) + tm_polygons("Region",border.col = "transparent") + tm_text("Region")
How can I eliminate the inside borders for each province, and create an outside border for each group (region) as in the example above with the white border?
Also, with tm_text()
How can I show only one label per group(region).
I don't know how to add zip files, but the link for the provinces shapefile is: https://geoportal.iderd.gob.do/geoserver/ows?service=WFS&version=1.0.0&request=GetFeature&typename=geonode%3ARD_PROV&outputFormat=SHAPE-ZIP&srs=EPSG%3A32619&format_options=charset%3AUTF-8
Forgive the spanish `:)