spatstat

how to find and remove illegal point in spatstat


I am trying to plot a ppp object and i get the following error:

In plot.ppp(x = list(window = list(type = "polygonal", xrange = c(556681.496972543,  :
  1 illegal points also plotted

Earlier it has also shown me the following error:

Warning message:
1 point was rejected as lying outside the specified window 

How may I find this point and remove it from within R or using spatstat within R?

Thank you.


Solution

  • The point is kept as an attribute so you can inspect it. To access the rejected point use attr(x, "rejects") where x is the name of your ppp.

    The attribute is discarded by almost any other operation than plot, so to permanently get rid of the rejected point you could use x <- as.ppp(x) where again x is the name of your ppp.