Description Usage Arguments Details Author(s) References
dbbmm_combine
function is a function that I worked up based on code from the R-Sig-Geo listserver (https://stat.ethz.ch/pipermail/r-sig-geo/2010-January/007422.html)
that takes the utilization distribution contours created from move.forud
that are output as individual shapefiles and imports them all into the workspace, ensures that the
ID values are unique (using spChFIDs, which is the reason I worked this function up), and then merges all the resultant shapefiles together into one object and then
assigns them to the selected projection and exports that shapefile to a user defined location.
1 | dbbmm_combine(filepath, crs, outpath, layer, write = TRUE)
|
filepath, |
file path (e.g., "C:/") statement to directory where all shapefiles from |
crs, |
coordinate reference system for identifying where the polygons are located. Uses standard |
outpath, |
file path using standard R path nomenclature specifying the location that the output shapefiles are to be written. Note that because |
layer, |
layer name as required by |
write, |
writes the resultant merged shapefiles to the location identified by outpath and layer, default is TRUE, but if FALSE returns the merged shapefile as a R object. |
This function, which I stole the base code for from R-Sig-Geo https://stat.ethz.ch/pipermail/r-sig-geo/2010-January/007422.html is
a simplifying function that collects all the shapefiles created by move.forud
and/or move.contour
function call and merges them all into a single
SpatialPolygonDataFrame, while carrying through all the important attributes created by move.forud
, and allows for the user to write (using writeOGR
)
the resultant combined data into a shapefile for further use. The the primary reason for this is that when I create the dbbmm polygons for each time step, I did not
adjust (cause I am not smart enough yet) the FID values for each, and thusly rbind
does not work to merge all the files together, even when nested within a
do.call()
function (although, surprisingly enough, rbind(out[[i]], out[[i+1]]) does work, but if you add out[i+2] it bombs. There was a suggestiont that rbind(..., makeUniqueIDs = TRUE) would work, but it does not).
So, until I figure out how to make one of the apply statements work, this crude hack will have to work.
Again, I note this is just a function I worked up that I shamelessly stole from list authors at https://stat.ethz.ch/pipermail/r-sig-geo/2010-January/007422.html. Note that I did not define any extra functions
for writeOGR
as I did not want to mess with them, but if someone needs another (such as driver= something other than ESRI Shapefile), let me know.
Bret A. Collier <bret@lsu.edu>
Kranstauber, D., R. Kays, S. D. Lapoint, M. Wikelski, and K. Safi. 2012. A dynamic Brownian bridge movement model to estimate utlization distributions for heterogenous animal movement. Journal of Animal Ecology, DOI: 10.1111/j.1365-2656.2012.01955.x.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.