[R-sig-Geo] raster: use extract to get data from a categorical/discrete/factor raster
Andy Bunn
Andy.Bunn at wwu.edu
Wed Aug 22 20:28:28 CEST 2012
I have foo which is a SpatialPointsDataFrame and bar which is a raster containing land-cover data (i.e., bar is categorical).
The easiest way to extract the landcover for each point in foo is:
extract(bar, foo, method='simple')
However, I'd like to do get the majority value from the values of the four nearest raster cells - the categorical equivalent of:
extract(bar, foo, method='bilinear')
which is obviously the wrong move with a discrete raster.
Advice appreciated!
More information about the R-sig-Geo
mailing list