Collective Motion Metrics from Raw Data
Source:R/wrap_col_motion_metrics.R
col_motion_metrics_from_raw.Rd
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).
Author
Marina Papadopoulou m.papadopoulou.rug@gmail.com
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
)
#> Note: the chosen threshold is smaller than the min value of
#> speed in the data, each set will consist of a single event.
#> Note: the chosen threshold is smaller than the min value of
#> pol in the data, each set will consist of a single event.
#> Given thresholds return a total of:
#> 1 events, over 0.416666666666667 min.
#> Calculating metrics for each event, this might take a while...