This function calculates and adds the speed and heading of each individual over time in the dataset, and splits it in a list of dataframes based on the defined sets.
Arguments
- data
A data frame with time series of individual's positional data, as exported by the
set_data_format
function. Columns needed:set
,t
,id
,x
,y
.- geo
Logical, whether positions are geographic coordinates, default = FALSE.
- verbose
Logical, whether to post updates on progress, default = FALSE.
- parallelize
Logical, whether to run the function in parallel over individuals, default = FALSE.
Value
A list of dataframes, an element per set from the input dataframe
with new columns: head
and speed
.
Author
Marina Papadopoulou m.papadopoulou.rug@gmail.com
Examples
data <- data.frame(
set = rep(1, 25),
x = rnorm(25, sd = 3),
y = rnorm(25, sd = 3),
t = as.POSIXct(1:25, origin = Sys.time()),
id = rep(1, 25)
)
data_list <- add_velocities(data, geo = FALSE)