我使用 maptools 包读取了shapefile,然后转换为.ppp
hfmd <- readShapeSpatial("NEWMERGE.shp")
hfmd2 <- as(hfmd, 'ppp')
当我输入hfmd2
时,我收到了此
Marked planar point pattern: 1092 points`
Mark variables: X, Y, Status, ID`
window: rectangle = [492623.7, 609905.3] x [444011.4, 645190.4] units`
当我输入Gcross(hfmd2)
来运行 Cross G 功能时,我收到此错误
Error in marks.ppp(X, ...) :`
Sorry, not implemented when the marks are a data frame`
我的问题是:
Gcross()
仅适用于Multitype标记的平面点图案对象吗? .ppp
对象转换为Multitype标记的平面点图案对象?答案 0 :(得分:0)
您当前的ppp
有四种不同的标记值:X
,Y
,Status
,ID
。您想为Gcross
使用哪一个?现在我假设它是Status
。然后,您可以使用单个标记向量替换包含每个点的四个标记值的data.frame
,如下所示:
marks(hfmd2) <- marks(hfmd2)$Status
现在您应该可以运行Gcross
:
Gc <- Gcross(hfmd2)
这将估算Gcross
中前两种类型之间的Status
。