To implement a choropleth, I looked back to some prompt code which I found on the Internet and read how to use the 'maptools' library to fortify a SpatialPolygonsDataFrame object. The premise that I have to make is that I installed recently R 3.6.0, also because the new version of 'sp' (necessary to make 'maptools' running correctly) requires it.
From the exploration I did, it turns out that the library 'gpclib' is not anymore available for R, and got substituted by 'rgeos'.
Now, I installed the most recent versions of 'maptools', 'rgeos' and 'rgdal', and in my code I am calling them in the sequence (for some security reasons related to my company, I had to specify a local path for the library):
library(sp) library(rgdal) library(ggplot2) library(rgeos) library(maptools)
The output for the rgeos library load looks like: "rgeos version: 0.4-3, (SVN revision 595) GEOS runtime version: 3.6.1-CAPI-1.10.1 Linking to sp version: 1.3-1 Polygon checking: TRUE "
However when I call maptools, it says: "Checking rgeos availability: FALSE Note: when rgeos is not available, polygon geometry computations in maptools depend on gpclib, which has a restricted licence. It is disabled by default; to enable gpclib, type gpclibPermit()"
So looks like maptools is not connected to rgeos. Consequently, when I try to fortify a SpatialPolygonDataFrame, I would get the error:
"Error in maptools::unionSpatialPolygons(cp, attr[, region]) : isTRUE(gpclibPermitStatus()) is not TRUE"
Then I am not understanding, neither finding related resources, how to solve this issue.