[R-sig-Geo] help to convert a data.frame in a Class ppp

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Mon Dec 27 13:49:41 CET 2010


On Sun, Dec 26, 2010 at 5:02 PM, gianni lavaredo
<gianni.lavaredo at gmail.com> wrote:
> Dear Researchers,
>
> I have a data.frame with tow columns (x and y) and I wish to convert in a
> ppp object
>
> point.df <-
> data.frame(x=c(749389.0,750000.0,750000.0,749389.0,750000.0,752500.0,752500.0,750000.0,752500.0,755000.0,755000.0,752500.0,755000.0,757500.0,757500.0,755000.0,757500.0,760000.0,760000.0),
> y=c(7275568,7275568,7277064,7277064,7275543,7275543,7277100,7277100,7275528,7275528,7277090,7277090,7275505,7275505,7277088,7277088,7275474,7275474,7277088))
>
> point.df
> plot(point.df$x,point.df$y)
>
>
> normally I use as.ppp but I don't undesrtand my error.
>
> thanks so much and sorry for destrub you in this period

 Your second error is not telling us what your first error was! -We
dont know how you were using as.ppp and if you were using it right.
You need to create a window (here I just take the bounds of your
points - the  true window is probably something different) and then
call as.ppp thus:

o=owin(range(point.df$x),range(point.df$y))
spat = as.ppp(point.df,o)
spat
> spat
 planar point pattern: 19 points
window: rectangle = [749390, 760000] x [7275500, 7277100] units

Barry



More information about the R-sig-Geo mailing list