op_compute_velocity {duet} | R Documentation |
Compute Velocity
Description
This function calculates the velocity for each column that begins with 'x' and 'y' and removes all columns that start with 'c'. It takes either the fps or the video duration as input to compute the velocity.
Usage
op_compute_velocity(
data,
fps = NULL,
video_duration = NULL,
overwrite = FALSE,
merge_xy = FALSE
)
Arguments
data |
A data frame containing the columns to process. |
fps |
Frames per second, used to compute velocity. |
video_duration |
Video duration in seconds, used to compute fps. |
overwrite |
Logical value indicating whether to remove original 'x' and 'y' columns. |
merge_xy |
Logical value indicating whether to merge x and y columns using Euclidean distance. |
Value
A data frame with velocity columns added and 'c' columns removed.
Examples
# Load example data from the package
data_path <- system.file("extdata/csv_data/A-B_body_dyad.csv", package = "duet")
data <- read.csv(data_path)
# Compute velocity
result <- op_compute_velocity(
data = data,
fps = 30,
overwrite = FALSE,
merge_xy = TRUE
)
print(result)
[Package duet version 0.1.1 Index]