[R] Convert tileplot's trellis to shapefile/ Add values to voronoi polygon

pearl may dela cruz pearlmayd at yahoo.com
Thu Dec 16 14:27:28 CET 2010


 I would like to create a voronoi map that can show me point values like the 
ones in colum street_cle. I was able to do it in tileplot(latticeExtra) like the 
ones attached, and with the following commands:


xy=list(x=x2$X, y=x2$Y)
xy$street_cle <- x2$street_cle
tileplot(street_cle~ x*y, xy)

But this is a trellis. Is it possible to be converted to a shapefile or image so 
I can plot it using spplot. I tried the following under tripack:

> tritest.vm <- voronoi.mosaic(x2$X,x2$Y)
> x2.vm <- voronoi.mosaic(x2$X,x2$Y)
>  plot(x2.vm)
> x2.vp <- voronoi.polygons(x2.vm)
> plot(x2.vp)

The mosaic is fine but when I made it to voronoi polygon, it gives me a weird 
plot just like the ones attached in this message. To add, this functions only 
plot the coordinates and does not have an option to add other values just like 
tileplot did in the street_cle column. 

In any way, can you help me on either  converting tileplot's trellis to 
shapefile/image or (solving the problem of voronoi polygons and adding another 
column to represent the polygons in tripack). 

Thanks a lot in advance,
Pearl dela Cruz



      


More information about the R-help mailing list