[R] any good way to convert sp class objects to splancs object

Dylan Beaudette dylan.beaudette at gmail.com
Wed Oct 25 23:12:00 CEST 2006


On Wednesday 25 October 2006 12:02, Roger Bivand wrote:
> On Wed, 25 Oct 2006, Dylan Beaudette wrote:
> > Greetings:
> >
> > are there any simple ways to convert an sp class object to a splancs ppp
> > class object, outside of reading the coordinates and computing a
> > bounding box?
>
> Aren't ppp class objects from the spatstat package? Have you tried the
> spspatstat wrapper package on the R-spatial sourceforge repository? The
> as() coerce method should get you there.
>
> If you really mean splancs, there are not wrappers yet, but are on their
> way.
>
> (Consider posting on R-sig-geo for specific questions like this).
>
> Roger
>
> > cheers,


Thanks for the reply Roger.

I made a slight mistake. I meant to say:

convert sp class object (point / polygon) to a *spatstat* ppp class object.

in the mean time i had come up with the following hack:

# extract data from sp coords slot
# extract data from sp bbox slot

#manually build ppp class object with the ppp() function.

#note that in spatstat the ordering of vertices in a polygon must be in 
counter-clockwise direction, so i had to reverse my vertex vectors.

i will post the worked up examples with data in a bit.

thanks!


-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341



More information about the R-help mailing list