0

我在 R 包 Spatstat 中创建点模式时遇到了一些问题。

> HI06mfav <- read.table("MarHI06mfav.txt", header = TRUE)
>  attach(HI06mfav)
The following object(s) are masked _by_ '.GlobalEnv':

x, y
The following object(s) are masked from 'HI06mfav (position 3)':

x, y
> HI06mfav.P <- ppp(x, y, c(-1, 11), c(-1, 11))
Warning message:
In ppp(x, y, c(-1, 11), c(-1, 11)) :
10 points were rejected as lying outside the specified window

> HI06mfav
      x        y
1  4.100800 6.526913
2  3.710310 6.189953
3  3.030026 6.696919
4  2.747816 6.417674
5  2.955485 6.125787
6  3.299942 5.922913
7  2.932207 5.549772
8  2.681645 5.641663
9  1.858555 5.686039
10 2.069101 5.427891
11 2.387927 5.227459
12 2.530470 5.383951
13 2.783648 5.019703
14 2.219491 4.767310
15 6.591515 8.160451
16 6.600408 8.567767
17 3.098551 3.561141
18 2.634305 3.571341

我以前使用过相同的代码,一切正常,所以我很困惑为什么它现在不起作用。我知道我可能需要使用 attach() 的替代方法,但是在尝试创建 ppp 后我不明白错误。

它甚至对取自 Spatstat 指南的示例代码做同样的事情:

> w <- owin(c(-1,1), c(-1,1))
> w <- as.mask(w)
> X <- raster.x(w)
> Y <- raster.y(w)
> M <- (X^2 + Y^2 <= 1)
> pp <- ppp(x, y, c(-1,1), c(-1,1), mask=M)
Warning message:
In ppp(x, y, c(-1, 1), c(-1, 1), mask = M) :
10 points were rejected as lying outside the specified window
> pp
planar point pattern: 0 points 
window: binary image mask
100 x 100 pixel array (ny, nx)
enclosing rectangle: [-1, 1] x [-1, 1] units  

我将通过 spatstat 指南回去尝试解决这个问题,但非常感谢任何帮助。

4

0 回答 0