[R-sig-Geo] (no subject)

Roger Bivand Roger.Bivand at nhh.no
Thu Mar 15 09:51:55 CET 2007


On Thu, 15 Mar 2007, Roger Bivand wrote:

> On Thu, 15 Mar 2007, Adrian Baddeley wrote:
> 
> > 
> > On Tue, 13 Mar 2007, Michael Friendly wrote:
> > 
> > > I've read the documentation, but can't find an example of how 
> > > to specify a circular window for the ppp object that would contain the
> > > data and the window.
> > 
> > To create a circular window in spatstat, you can use the 
> > function disc(). See help(disc). 
> > 
> > For example suppose a point pattern with coordinates x, y (two vectors)
> > is observed inside a pot with centre (x0, y0) and radius R.
> > Then 
> > 	   pot <- disc(R, c(x0,y0))
> > creates a window (owin object) representing the pot,
> > and
> > 	   X <- ppp(x, y, window=pot)
> > creates the point pattern. 
> > 
> > Since spatstat always plots spatial objects isometrically, you can also 
> > use plot(disc(....)) just to draw a circle. 
> > 
> > > The data structure is something like a data frame for all the 
> > > germinating seeds, recording (X,Y) location and maybe some other
> > > measure like size after xx days:
> > > 
> > > PotID Treatment SeedType  X    Y  size
> > 
> > Currently, a point pattern can only have one mark variable
> > (e.g. you can attach the SeedType to each point, or attach the size to
> > each point, but not both).
> > This will change in spatstat version 2 which will be released soon.
> > 
> > > (Is there something better?) 
> > 
> > There is nothing better than spatstat!  %^]
> 
> Great!
> 
> To get to the sp Polygon object:

Should be:

res0 <- coordinates(disc(1, c(0,0))$bdry)
res <- Polygon(rbind(res0, res0[1,]))

to turn the list into a matrix, sorry.

Roger

> 
> res0 <- disc(1, c(0,0))$bdry
> res <- Polygon(rbind(res0, res0[1,]))
> 
> should anyone need it.
> 
> Roger
> 
> 
> > 
> > regards
> > Adrian Baddeley
> > 
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list