[R-sig-Geo] Grids clipped with polygon

Susumu Tanimura stanimura-ngs at umin.ac.jp
Wed Aug 3 08:40:17 CEST 2005


Hi there,

Grids clipped with polygon is just required for my kriging analysis,
but I could not succeed so far.  I probed into gpclib, inside.owin() in
spatstat, inpip() in splancs, symbolsInPoly() in maptools.

> library(maptools)
> V.poly <- Map2poly(read.shape("vietnam-utm48n.shp"))
Shapefile Type: Polygon   # of Shapes: 61
> np <- sapply(V.poly, function(x) attr(x, "nPart"))
> np
 [1]   1 510   3   2   1   1   2   7   4   1   2   1   1   1   1   1   1 105   2
[20]   5   1 682   1   1   1   2   7   8   3   2   3  46   1   3   8   7 138   1
[39]   1   3   1   1   1   1   1   3   1   3  15   1   1   1   3   1   1  41   1
[58]   2   1   1   1
> try1 <- symbolsInPolys(V.poly, 5000)

Spatial Point Pattern Analysis Code in S-Plus

 Version 2 - Spatial and Space-Time analysis
Error in if (counts[[i]] > 0) { : missing value where TRUE/FALSE needed
In addition: There were 32 warnings (use warnings() to see them)

It is very happy if someone give me some advice about the error or
alternative approach.  I just want to have grid trimmed by polygon
boundary like meuse.grid in gstat.

--
Susumu Tanimura
Dept. of Socio-environmental Medicine
Inst. of Tropical Medicine, Nagasaki University
e-mail stanimura-ngs at umin.ac.jp




More information about the R-sig-Geo mailing list