[R-sig-Geo] raster::polygonValues?
Rolf Turner
r.turner at auckland.ac.nz
Wed Apr 18 22:31:37 CEST 2012
If you read the ChangeLog carefully (!) you will see:
> --- 30-Oct-2010, version 1.6-10
> <SNIP>
> New generic function 'extract', to replace xyValues, cellValues,
> lineValues, polygonValues
I.e. look at ?extract.
cheers,
Rolf Turner
On 19/04/12 05:32, Christopher Swingley wrote:
> 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
More information about the R-sig-Geo
mailing list