Learn R Programming

AnimalSequences (version 0.2.0)

element_duration: Calculate Individual Element Durations

Description

This function calculates the individual element durations and compares them to a shuffled distribution.

Usage

element_duration(sequences_long, n_permutations = 1000)

Value

A data frame with the median duration, standard deviation, expected duration, effect size, and p-value for each element.

Arguments

sequences_long

A data frame containing sequences with start and end times for each element.

n_permutations

An integer specifying the number of permutations to perform. Default is 1000.

Examples

Run this code
# Example usage:
sequences_long <- data.frame(
  element = c("A", "B", "C", "A", "B", "C"),
  start_time = c(0, 5, 10, 15, 20, 25),
  end_time = c(5, 10, 15, 20, 25, 30)
)
result <- element_duration(sequences_long, n_permutations = 100)
print(result)

Run the code above in your browser using DataLab