dbbmm_combine: Function for merging all the unique utilization distribution...

Description Usage Arguments Details Author(s) References

Description

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.

Usage

1
dbbmm_combine(filepath, crs, outpath, layer, write = TRUE)

Arguments

filepath,

file path (e.g., "C:/") statement to directory where all shapefiles from move.forud output are located

crs,

coordinate reference system for identifying where the polygons are located. Uses standard CRS structure within quotes: CRS("+proj=longlat +zone=14 +datum=NAD83")

outpath,

file path using standard R path nomenclature specifying the location that the output shapefiles are to be written. Note that because writeOGR is being used, the outpath must include both the file path (e.g., "C:/" and the name/extension that the user want's the merged shapefile to be named (e.g., "C:/TestShapefile.shp")

layer,

layer name as required by writeOGR

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.

Details

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.

Author(s)

Bret A. Collier <bret@lsu.edu>

References

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.


bacollier/moveud documentation built on May 11, 2019, 5:24 p.m.