在R中裁剪栅格
我正在为美国东北部绘制地图。地图背景必须是海拔图或年平均温度图。我有来自Worldclim.org的两个栅格,这些栅格为我提供了这些变量,但是我需要将它们裁剪到我感兴趣的州的范围。有关如何执行此操作的任何建议。这是我到目前为止所拥有的: #load libraries library (sp) library (rgdal) library (raster) library (maps) library (mapproj) #load data state<- data (stateMapEnv) elevation<-raster("alt.bil") meantemp<-raster ("bio_1.asc") #build the raw map nestates<- c("maine", "vermont", "massachusetts", "new hampshire" ,"connecticut", "rhode island","new york","pennsylvania", "new jersey", "maryland", "delaware", "virginia", "west virginia") map(database="state", regions = nestates, interior=T, lwd=2) map.axes() #add …