[R-sig-Geo] using 'mask' versus 'crop' in raster

Travis Belote tbelote at tws.org
Mon Aug 10 19:56:03 CEST 2015


Hi all,

I am trying to extract a raster layer of data to a specific region defined by a shapefile. In Arc I would do this using "extract by mask" and have had some luck using "mask" in the raster package. I am able to consistently use "crop" to limit the extent of the raster data, but I cannot consistently use "mask." The projections of the raster and shapefile are the same. The raster represents data for all of North America (called "ens" below) and I am trying to extract just the data from the contiguous United States (shapefile called "conus" below).

Here is the line of code and the Error message.



conusensMASK <- mask(ens, conus)
Error in mask(ens, conus) : unused argument (conus)

I was having trouble with this a few weeks ago. I updated all my packages and that seemed to take care of the issue for a day when "mask" worked beautifully. Again, "crop" works fine. But, I am again receiving the error from "mask".

Thank you for any suggestions or advice.
Sincerely,
Travis


R. Travis Belote, PhD
Research Ecologist
The Wilderness Society
Bozeman, MT 59715
406.581.3808


	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list