【发布时间】:2013-06-21 22:16:49
【问题描述】:
我在 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 Format the ggplot2 map 中找到的 shapefile,数据为 https://docs.google.com/file/d/0B_coFit6AovfcEFkbHBjZEJaQ1E/edit
【问题讨论】: