Skip to contents

This function calculates the average speed, polarization and shape of a group through time.

Usage

group_metrics(data, geo, step2time = 1, parallelize = FALSE)

Arguments

data

A dataframe of (ordered) time series of headings, positions, and speeds per individual. The dataframe may contain several individuals. Should include the columns: id, t, speed, x, y, head, set.

geo

Logical, whether positions are geographic coordinates, default = FALSE.

step2time

Numeric, the sampling frequency of the data (the relation between a row in the data and real time in seconds).

parallelize

Logical, whether to parallelize over time. Suggested only for very large datasets.

Value

A dataframe with the group average timeseries, with columns: set, t, pol, speed, shape, N (number of individuals), missing_ind (whether some individuals are missing).

Author

Marina Papadopoulou m.papadopoulou.rug@gmail.com

Examples

data <- data.frame(
 set = rep("1", 50),
 t = as.POSIXct(rep(1:25, 2), origin = Sys.time()),
 id = c(rep(1, 25), rep(2, 25)),
 x = rnorm(50),
 y = rnorm(50),
 head = runif(50, 0, 2 * pi),
 speed = rnorm(50)
 )

gm <- group_metrics(data,
 geo = FALSE,
 step2time = 1)