Skip to content
Back to formatted view

Raw Message

Message-ID: <4F8F24A9.4050503@auckland.ac.nz>
Date: 2012-04-18T20:31:37Z
From: Rolf Turner
Subject: raster::polygonValues?
In-Reply-To: <CAHsw44858z6iCOzmJogK2O6SzD5XcSubA1ffsuZDTKLFTjtNiw@mail.gmail.com>

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