ggplot2 패키지의 fortify 함수를 사용하여 공간 객체를 data.frame으로 변환하려고합니다. 하지만 오류가 발생합니다. 나는 유타 개체를 변환 할 때, 그러나ggplot2의 함수 강화 오류
> str(utah)
[email protected] data :'data.frame': 10 obs. of 8 variables:
.. ..$ AREA : num [1:10] 1.42e+11 1.33e+11 3.10e+11 4.47e+10 1.26e+11 ...
.. ..$ PERIMETER : num [1:10] 4211300 3689180 4412500 2722190 3388270 ...
.. ..$ USECO_ : int [1:10] 164 170 204 208 247 367 373 386 409 411
.. ..$ USECO_ID : int [1:10] 163 216 201 206 245 366 372 385 408 410
.. ..$ ECO : Factor w/ 7 levels "13","14","18",..: 7 3 1 4 5 6 2 4 4 6
.. ..$ LEVEL3 : int [1:10] 80 18 13 19 20 21 14 19 19 21
.. ..$ LEVEL3_NAM: Factor w/ 7 levels "Central Basin and Range",..: 4 7 1 6 2 5 3 6 6 5
.. ..$ id : chr [1:10] "0" "1" "2" "3" ...
...
...
:
require("rgdal")
require("maptools")
require("ggplot2")
require("plyr")
utah = readOGR(dsn="/path/to/shapefile", layer="eco_l3_ut")
OGR data source with driver: ESRI Shapefile
Source: ".", layer: "eco_l3_ut"
with 10 features and 7 fields
Feature type: wkbPolygon with 2 dimensions
[email protected]$id = rownames([email protected])
모든 확인을 작동하는 것 같다 예를 들어, Hadley Wickhan's plotting polygon shapefiles example에 사용되는 동일한 코드 다음, 나는 명령의 다음 줄을 입력
> utah.points = fortify(utah, region="id")
Error in UseMethod("fortify") : no applicable method for 'fortify' applied to an object of class "c('SpatialPolygonsDataFrame', 'SpatialPolygons', 'Spatial')"
내가 시도 다른 모든 공간 객체에 대해 같은 오류가 점점 오전 : 함수를 사용하면 packcage의 ggplot2에서 강화, 나는 다음과 같은 오류가 발생합니다 강화를 사용하여 변환; (R의 버전 3.0.2로 업그레이드하기 전에) 과거에 괜찮은 코드를 사용할 때조차도.
Intel Core i7 및 16GB RAM이 장착 된 Mac에서 R 버전 3.0.2를 실행하고 있습니다.