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

From: Dylan Beaudette <dylan.beaudette_at_gmail.com>
Date: Wed 25 Oct 2006 - 21:12:00 GMT

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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu Oct 26 06:59:17 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 25 Oct 2006 - 21:30:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.