[R-sig-Geo] using 'mask' versus 'crop' in raster
Matt Strimas-Mackey
strimas at zoology.ubc.ca
Mon Aug 10 20:48:02 CEST 2015
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> 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.
> Sincerely,
> Travis
>
>
> R. Travis Belote, PhD
> Research Ecologist
> The Wilderness Society
> Bozeman, MT 59715
> 406.581.3808
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list