sequence_duration_summary {AnimalSequences}R Documentation

Summarize Sequence Durations

Description

This function calculates summary statistics for the durations of sequences, where the duration is defined as the difference between 'end_time' and 'start_time'. If 'duration' is provided, it will be used directly.

Usage

sequence_duration_summary(sequences, start_time, end_time, duration = NULL)

Arguments

sequences

A character vector where each element is a sequence of elements separated by spaces.

start_time

A numeric vector representing the start times of the sequences.

end_time

A numeric vector representing the end times of the sequences.

duration

(Optional) A numeric vector representing the durations of the sequences. If 'NULL', it will be calculated as 'end_time - start_time'.

Value

A data frame with the following columns:

mean_seq_duration

The mean duration of the sequences.

sd_seq_duration

The standard deviation of the sequence durations.

median_seq_duration

The median duration of the sequences.

min_seq_duration

The minimum duration of the sequences.

max_seq_duration

The maximum duration of the sequences.

Examples

sequences <- c('hello world', 'hello world hello', 'hello world hello world')
start_time <- c(1, 2, 3)
end_time <- c(2, 4, 7)
sequence_duration_summary(sequences, start_time, end_time)

[Package AnimalSequences version 0.2.0 Index]