0

I've converted the shapefile to class SpatialPolygons and that to a window with as(x, "owin") but I can't find anything that will work with

ppp(x, y, poly= _______ )

What format do I have to get the shapefile in to use it as a window in a PPP object?

Thanks

  • What is the `poly = ______` argument? The argument to assign a window to the point pattern should be `window= `. Can you make an arbitrary window around the points? – Andy W Dec 14 '11 at 21:02
  • Here's the passage I was using from Baddeley and Turner's intro to Spatstat: Spatstat supports polygonal windows of arbitrary shape and topology. That is, the boundary of the window may consist of one or more closed polygonal curves, which do not intersect themselves or each other. The window may have ‘holes’. Type ppp(x, y, poly=p) to create a point pattern with a polygonal window. Again, x and y are the vectors of coordinates of the points. The argument poly=p indicates that the window is polygonal and its boundary is given by the dataset p. – Mark Palko Dec 14 '11 at 21:13
  • looking at `help(ppp)` it appears when you specify the `poly` statement it expects a list, not an owin object. Try to specify the window using the `window` argument. The passage you cite has nothing to do with making a `ppp` object, only with making the original window object from a list of X & Y coordinates. – Andy W Dec 14 '11 at 21:28

3 Answers3

2

Baddeley recently published a vignette that describes how to use spatstat with shapefiles: see http://cran.r-project.org/web/packages/spatstat/vignettes/shapefiles.pdf

0

if you have a ppp object x and a owin object W, then you just do x <- x[W]

EconGeo
  • 33
  • 5
0

If you have already converted your polygon shapefile to an owin (window) object W, then you can simply use this object as the argument window to the function ppp:

X <- ppp(x, y, window=W)

The confusion arises because the function ppp allows the user to specify the bounding window in many different ways. Essentially it gathers any arguments that it does not recognise, and passes them to the function owin which uses them to make a window. The argument poly is not recognised by ppp so it would be passed to owin: see help(owin) for an explanation of such arguments.

Adrian Baddeley
  • 1,956
  • 1
  • 8
  • 7