prep_data {bayesmove} R Documentation

## Calculate step lengths, turning angles, net-squared displacement, and time steps

### Description

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., adehabitatLT). However, functions from other packages can also be used to perform this step in data preparation.

### Usage

prep_data(dat, coord.names, id)


### Arguments

 dat 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 POSIXct and be labeled date within the data frame. coord.names 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. id character. The name of the column storing the animal IDs.

### Value

A data frame where all original data are returned and new columns are added for step length (step), turning angle (angle), net-squared displacement (NSD), and time step (dt). Names for coordinates are changed to x and y. Units for step and NSD depend on the projection of the coordinates, angle is returned in radians, and dt is returned in seconds.

### Examples

#load data
data(tracks)

#subset only first track
tracks<- tracks[tracks\$id == "id1",]

#calculate step lengths and turning angles
tracks<- prep_data(dat = tracks, coord.names = c("x","y"), id = "id")



[Package bayesmove version 0.2.1 Index]