我在 ggplot2 中使用 fortify 方法收到此错误:
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘proj4string’ for signature ‘"NULL"’
代码如下:
> library(maptools)
> gpclibPermit()
> library(ggplot2)
> library(rgdal)
> library(rgeos)
> library(ggmap)
> brMap <- readShapePoly("Google/BRASIL.shp")
> brMapDF <- fortify(brMap)
# This actually works
# But this don´t
> brMapDF <- fortify(brMap, region="UF")
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘proj4string’ for signature ‘"NULL"’
我拥有的所有 shapefile 都会发生这种情况,因此我尝试(在上面的代码中)使用我在 stackoverflow 中找到的 shapefile格式化 ggplot2 地图,数据为https://docs.google.com/file/d/0B_coFit6AovfcEFkbHBjZEJaQ1E /编辑