1

我正在尝试在 R 中编写一个小脚本,在 QGIS 中创建一个 K Ripley 的图形函数。

这是代码:

  ##Point pattern analysis=group
    ##Layer=vector
    ##Titulo=string
    ##Folder=folder
    ##showplots

    library("maptools")
    library("spatstat")


    K <- as.ppp(Layer)
    E <- envelope (K, fun=Kest, nsim=99)
    plot(E, main=Titulo)
    write.csv(K,Folder)

当我运行脚本时,我收到以下消息:

错误 enmarks.ppp (Y, dfok=FALSE): 抱歉,当标记是数据框时未实现。

调用:信封->信封.ppp->marks->marks.ppp

Ademas: Mensaje de avisos perdidos

1:点阵列对象中的某些标记值为 NA。2:点图案 Y 中的部分标记值为 NA。

有人知道我错过了什么吗?

谢谢!

4

1 回答 1

2

If K is a marked point pattern then Kest tries to do things with the pattern grouped by the mark, such as the cross-K-function. The mark here is usually a simple categorical vector which defines type-1 and type-2 points, for example in a case-control point pattern.

If the mark object in the ppp object is a data frame, it doesn't really know what to do with it. In this case the SpatialPointsDataFrame (converted by maptools, with a default bounding box window, which is probably a bad thing) keeps its data frame information, which is the QGIS attribute list, as the mark in the ppp object.

If you don't care about the point attributes and only the locations, then unmark the point pattern:

K <- unmark(as.ppp(Layer))
于 2014-07-23T13:15:30.277 回答