在 sp 中使用 over 函数:保留空间特征

Using over function in sp: Preserving spatial charactersitics

你好 我在 sp 包中使用 over 函数,想知道它是否保留了结果中的空间特征。如您所知,空间特征是将数据连接到另一个数据集以执行分析所必需的。

例如:我有一个控制数据集作为 spatialPointsDataFrame 和斜率作为 spatialGridDataFrame。我想使用 over 如下:

> Slope.ov = over(control, Slope)  # the result is:
 'data.frame':  500 obs. of  1 variable:
 $ slope: num  NaN 0.477 0.87 1.172 0.534 ...

然后我想将提取的数据添加到控制数据集中。如何确保添加到控制数据集的数据在空间上处于正确的位置?

> control$slope =Slope.ov$slope

over 保留数据的顺序。因此,如果您按照建议添加矢量,数据将按正确的顺序添加到正确的位置。