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

Travis Belote tbelote at tws.org
Mon Aug 10 21:00:39 CEST 2015

That appears to be the problem. Thank you for your time responding! I’m still relatively new to R… or at least I’m still learning some of these basic ways of trouble-shooting issues. I greatly appreciate your help!

FYI I had Hmisc loaded, which was causing the problem. I will know to check this next time.

Thanks so much again!

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

From: Matt Strimas-Mackey [mailto:strimas at zoology.ubc.ca]
Sent: Monday, August 10, 2015 12:48 PM
To: Travis Belote
Cc: r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] using 'mask' versus 'crop' in raster

Seems like you may have some other function called mask either defined by you or in another package loaded after raster. A couple things you could check:
-just type "mask" (without quotes) in the console. The first line should say something like:
standardGeneric for "mask" defined from package "raster"
-try raster::mask(ens, conus) to directly access mask in the raster package
-Install and load the pryr package and run "pryr::where(mask)" (again, without quotes) to see which environment mask is located in

On Mon, Aug 10, 2015 at 10:56 AM, Travis Belote <tbelote at tws.org<mailto:tbelote at tws.org>> wrote:
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.

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

        [[alternative HTML version deleted]]

R-sig-Geo mailing list
R-sig-Geo at r-project.org<mailto:R-sig-Geo at r-project.org>

	[[alternative HTML version deleted]]

More information about the R-sig-Geo mailing list