【发布时间】:2014-11-17 02:05:22
【问题描述】:
shapefile“Property1A”的数据集是:
df
# suburb area asst
# 0 Te Aro 14.541780 R076
# 1 Te Aro 7.655428 R076
# 2 Te Aro 3189.976134 <NA>
# 3 Te Aro 242.173386 0132
# 4 Karori 537.697290 R003
# 5 Pipitea 1116.954993 R105
# 6 Mt Cook 106.099900 R151
# 7 Te Aro 83.307421 R057
# 8 Aro Valley 544.665788 R105
# 9 Aro Valley 59.726882 R110
当我尝试对郊区“Te Aro”的 shapefile 进行子集化时,我使用的代码是:
TeAro <- subset(Property1A, suburb == "Te Aro")
但是有一个错误:
TeAro <- subset(Property1A, suburb == "Te Aro")
# Error in eval(expr, envir, enclos) : object 'suburb' not found
为什么会出错?
【问题讨论】:
-
请提供可重现的示例。您是否创建了一个名为
Property1A的对象(您的示例表明您有一个名为df的对象)?你是怎么读到这个形状文件的? -
df
-
Property1A 是一个 shapefile
-
你是什么意思“Property1A”是一个shapefile。你是怎么读到
R的? -
Property1[Property1$suburb %in% "Te Aro",]