[R-sig-Geo] raster::polygonValues?
Christopher Swingley
cswingle at gmail.com
Wed Apr 18 19:32:41 CEST 2012
Greetings!
I'm re-running a script I used in 2009 that looked similar to the
following. The idea is to intersect a series of watershed polygons
with rasters of climate data and calculate some basin statistics for
each basin x climate raster.
library(raster)
library(rgdal)
grids <- list.files('climatology', pattern = '*.tif$')
basins <- readOGR('basins', 'all_basins')
for (grid in grids) {
r <- raster(grid)
v <- polygonValues(basins, r)
basin_means <- sapply(v, mean)
basin_sd <- sapply(v, sd)
basin_n <- sapply(v, length)
}
But now I get 'Error: could not find function "polygonValues"'.
Searches on the Internet lead me to believe 'polygonValues' is in the
raster package, and it's mentioned in four places in the raster
package changelog, but I can't find mention of it's removal.
Has polygonValues been replaced with something else? Did this
morning's "install.packages('raster')" not build the whole thing
somehow?
Thanks,
Chris
--
Christopher Swingley
Fairbanks, Alaska
http://swingleydev.com/
cswingle at gmail.com
More information about the R-sig-Geo
mailing list