0

在 spatstat 中,如果您有重复项或长度等于 ppp 对象中点数的整数(重数)的数字向量,则有许多函数返回逻辑向量。我找不到允许您将多重性结果作为标记直接添加到您的 ppp 对象的功能。你怎么能做到这一点?你怎么能得到一个新的 ppp 对象,其中包含每对坐标中的事件计数作为标记?

另一种问法是,multiplicity.ppp 产生的结果向量的顺序是如何确定的?假设您已经在 ppp 对象 x 中测试了多重性,并基于此“multiple_x”创建了一个向量。

x <- ppp(x = mycoords[,1], y = mycoords[,2],
                   window = window, check = T)
multiple_x <- multiplicity.ppp(x)

你可以简单地使用原始坐标和新向量作为标记创建一个新的 ppp 对象吗?

x <- ppp(x = mycoords[,1], y = mycoords[,2],
                   window = window, check = T,
                   marks = multiple_x)

提前谢谢了。

4

1 回答 1

0

You can create a new point pattern using ppp as you have proposed.

But it would be much easier to assign the marks to an existing point pattern X using the idiom marks(X) <- value. (See the help for marks<-.ppp)

Example:

Y <- X
marks(Y) <- multiplicity(X)

Then Y is the same pattern as X except that each point is marked by an integer indicating the number of points at the same location.

If you wanted to collapse the duplicated points in the point pattern X, retaining only one instance of each duplicated point but with a mark indicating its multiplicity, then just do

Z <- Y[!duplicated(X)]

Examples are given in the help file for multiplicity.ppp

于 2021-04-03T09:46:41.133 回答