This I know is a fairly common error with gpclib but I feel I've tried a lot of options and going around in circles. I come up against this issue when using 'fortify' to create a data frame from a UK local authority shapefile, so that eventually I can create a choropleth using ggplot2.
After trying to install gpclib package in the usual way I then tried to install from source:
install.packages("gpclib", type = "source")
Which says unsuccessfully unpacked but then 'ERROR: compilation failed for package 'gpclib'. I then read somewhere you need to have R Tools installed so I tried that but to no avail, same error. I then tried changing the order in which you attach rgeos and maptools because apparently this matters and this didn't work.
My code is dead simple and yet I'm at a brick wall early in the project.
Are there any other things to try to get gpclib installed?
Many thanks in anticipation, my code is below. Henry
install.packages("rgdal")
library(rgdal)
install.packages("maptools")
library(maptools)
install.packages("rgeos")
library(rgeos)
myshape <- readShapeSpatial("infuse_ward_lyr_2011.shp")
myshape2 <- readShapeSpatial("infuse_dist_lyr_2011.shp")
plot(myshape)
plot(myshape2)
install.packages("ggplot2")
library(ggplot2)
str(myshape2)
myshape2frame <- fortify(myshape2, region="name")
install.packages("gpclib", type = "source")
library(gpclib)
gpclibPermit()
gpclibPermitStatus()