Extracting values from inside polygons raster r
问题 I'm trying to find the mean daily temperature for counties in South Dakota from raster grids ('bil' files) found at http://prism.oregonstate.edu/. I am getting county boundaries from the 'maps' package. library(maps) library(raster) sd_counties <- map('county','south dakota') sd_raster <- raster('file_path') How do I extract the grid cells within each county? I think I need to turn each county into it's own polygon to do this, but how? Then, I should be able to do something like the following