Skip to content
Prev 22593 / 29559 Next

over() in sp package

Kenny,

Here is an alternative route

library(raster)
states <- shapefile("cb_2013_us_state_20m.shp")
tMaxGrid <- raster(unzippedFiles[1])
x <- extract(tMaxGrid, states)

This returns a list of the length of states. Each list element has a
vector with the grid cell values.

For a mean do

xs <- extract(tMaxGrid, states, fun=mean)

See ?extract for weights

Robert
On Mon, Apr 13, 2015 at 4:27 PM, Kenny Bell <kmb56 at berkeley.edu> wrote: