Skip to content
Prev 23216 / 29559 Next

using 'mask' versus 'crop' in raster

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