Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
225 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...