x <- read.shape(system.file("shapes/sids.shp", package="maptools")[1])
ncpolys <- Map2poly(x)
try1 <- dotsInPolys(ncpolys, as.integer(x$att.data$SID74))
plot(ncpolys)
xx <- lapply(try1, function(x) {if (!is.null(x)) points(x, pch=18, col="red")})
try2 <- dotsInPolys(ncpolys, as.integer(x$att.data$SID74), f=gridpts)
plot(ncpolys)
xx <- lapply(try2, function(x) {if (!is.null(x)) points(x, pch=18, col="red")})
Run the code above in your browser using DataLab