Calculates step lengths, turning angles, and net-squared displacement based
on coordinates for each animal ID and calculates time steps based on the
date-time. Provides a self-contained method to calculate these variables
without needing to rely on other R packages (e.g.,
However, functions from other packages can also be used to perform this step
in data preparation.
prep_data(dat, coord.names, id)
A data frame that contains a column for animal IDs, the columns
associated with the x and y coordinates, and a column for the date. For
easier interpretation of the model results, it is recommended that
coordinates be stored in a UTM projection (meters) as opposed to
unprojected in decimal degrees (map units). Date-time should be of class
character. A vector of the column names under which the coordinates are stored. The name for the x coordinate should be listed first and the name for the y coordinate second.
character. The name of the column storing the animal IDs.
A data frame where all original data are returned and new columns are
added for step length (
step), turning angle (
net-squared displacement (
NSD), and time
dt). Names for coordinates are changed to
y. Units for
NSD depend on the projection of the
angle is returned in radians, and
returned in seconds.