Point Patterns in Spatstat

淺唱寂寞╮ 提交于 2019-12-11 19:42:17

问题


I am having a few problems with creating a point pattern in the R package 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

I have used this same code before and everything worked fine, so I am confused at why it is not working now. I know that I might need to use an alternative to attach(), but I don't understand the error after I try to create the ppp.

It even does the same thing with example code taken right from the Spatstat guide:

> 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  

I am going back through the spatstat guide to try to figure this out, but any help would be very much appreciated.

来源:https://stackoverflow.com/questions/18025517/point-patterns-in-spatstat

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!