[R-sig-Geo] summarize cells of different value intervals in a raster file by items in ESRI shapefile

Robert Hijmans r.hijmans at gmail.com
Tue Apr 5 07:27:08 CEST 2011


> I have a raster file (cell value varies from 0 to 1) and a ESRI 
> shapefile (there are countries, and provinces inside each countries), 
> the two files overlapped in the same region. I want to summarized the 
> cells (with different value intervals, say 0.0-0.25, 0.25-0.5, 
> 0.5-0.75, 0.75-0.1) by countries and provinces in countries. This 
> means I want to output how many cells of (0.0-0.25, et al.) in each 
> country and each province. 

Jianfeng, you can have a look at the polygon example for the extract
function in raster. Robert

library(raster)
?extract 


--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/summarize-cells-of-different-value-intervals-in-a-raster-file-by-items-in-ESRI-shapefile-tp6239189p6241129.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list