Learn R Programming

swaRmverse (version 0.1.0)

events_n: Number of Events

Description

This function calculates the number of events of collective motion in a dataset.

Usage

events_n(data)

Value

an integer with the number of events of collective motion (sequences of keep == TRUE).

Arguments

data

A dataframe with a keep column (representing which rows are defined as events of collective motion) and a set column.

Author

Marina Papadopoulou m.papadopoulou.rug@gmail.com

See Also

define_events

Examples

Run this code

data <- data.frame(
set = c(rep('1', 50), rep('2', 50)),
keep = c(rep(FALSE, 10), rep(TRUE, 70), rep(FALSE, 20))
)

events_n(data) ## 2 events

Run the code above in your browser using DataLab