add_velocities {swaRmverse}R Documentation

Add Velocity Timeseries Across Sets

Description

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.

Usage

add_velocities(data, geo = FALSE, verbose = FALSE, parallelize = FALSE)

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(s)

Marina Papadopoulou m.papadopoulou.rug@gmail.com

See Also

add_set_vels, set_data_format

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)


[Package swaRmverse version 0.1.0 Index]