col_motion_metrics_from_raw {swaRmverse}R Documentation

Collective Motion Metrics from Raw Data

Description

This function calculates metrics of collective motion across sets and events.

Usage

col_motion_metrics_from_raw(
  data,
  mov_av_time_window,
  step2time = 1,
  geo = FALSE,
  verbose = FALSE,
  speed_lim = NA,
  pol_lim = NA,
  parallelize_all = FALSE,
  noise_thresh = 0
)

Arguments

data

A data frame with time series of individual's positional data through time. Columns must include: id, set, t, x, y.

mov_av_time_window

Numeric, a time window to average over for speed and polarization timeseries (in timesteps).

step2time

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

geo

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

verbose

Logical, whether to post updates on progress, default = FALSE.

speed_lim

Numeric, the threshold of speed for the definition of an event. For more info see: pick_threshold.

pol_lim

Numeric, the threshold of polarization for the definition of an event. For more info see: pick_threshold.

parallelize_all

Logical, whether or not to parallelize over timesteps.

noise_thresh

Numeric, the limit of time difference between consecutive events to be considered the same event. Default value is 0 (no event merging).

Value

A dataframe with metrics of collective motion per event.

Author(s)

Marina Papadopoulou m.papadopoulou.rug@gmail.com

See Also

add_velocities, group_metrics, pairwise_metrics, moving_average

Examples

data <- data.frame(
 set = rep(1, 75),
 x = rnorm(75, sd = 3),
 y = rnorm(75, sd = 3),
 t = as.POSIXct(rep(1:25, 3), origin = Sys.time()),
 id = c(rep(1, 25), rep(2, 25), rep(3, 25))
 )

metrics <- col_motion_metrics_from_raw(data,
 mov_av_time_window = 5,
 step2time = 1,
 geo = FALSE,
 speed_lim = 0,
 pol_lim = 0,
 noise_thresh = 1
 )


[Package swaRmverse version 0.1.0 Index]