Page 1 of 1

Habitat Mask Polygon

PostPosted: Tue Apr 01, 2014 2:26 pm
by Lombardijv
Murray,

I wanted to add a shapefile of my study area (which also included all non-habitat (e.g., roads, bodies of water) to create a new habitat mask. I successfully loaded my shapefile as a polygon into R using readShapeFile, but when I wrote the make.mask code I received an error and I do not know how to proceed. I wanted to know if you can recommend how I should correct this.

Code: Select all
 NacPoly <- readShapePoly("nac_boundry.shp")

 nacmask <- make.mask(traps(BCVCH), type = "trapbuffer", buffer = 1000, spacing = 641.533, nx=64, poly = "NacPoly", poly.habitat=TRUE, keep.poly = TRUE)

Error in FUN(newX[, i], ...) :
  NA/NaN/Inf in foreign function call (arg 5)
In addition: Warning message:
In FUN(newX[, i], ...) : NAs introduced by coercion




Thank You,

Jason

Re: Habitat Mask Polygon

PostPosted: Tue Apr 01, 2014 3:03 pm
by murray.efford
I can't see a problem in your code; maybe there's something odd in your data. If you can't find the problem then send me the files and I'll post what I find.
Murray

Re: Habitat Mask Polygon

PostPosted: Thu Apr 03, 2014 5:25 pm
by murray.efford
Do not put the poly name in quotes. I should have spotted this error right off. Also, do not specify both spacing and nx: one will do.
Murray