Hi all,
I'm trying to get the sum of value z for all points that fall within a grid
square. I've been trying to use the overlay function on a grid converted to
polygons, however, it returns the sum of the coordinates and the z values,
how can I have it return only the sum of z?
Also, once I have the sum of z how then can I assign that to it's
corresponding grid square?
## Example code
g <- GridTopology(c(-10,-10), c(1,1), c(21,21))
g.poly <- as(g, "SpatialPolygons")
x <- c(1:10,1:10)
y <- c(10:1,10:1)
z <- 1:20
xyz <- SpatialPointsDataFrame(cbind(x,y),data.frame(z))
ol <- overlay(xyz, g.poly, fn=sum)
Thanks in advance.
Andrew.
--
Andrew Hoskins
PhD Candidate
School of Life and Environmental Sciences
Deakin University, Australia
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo