reformat_marker_data function

reformat and Sort Marker Data for All Time Frames

reformat and Sort Marker Data for All Time Frames

reformat the input dataset by sorting marker columns based on marker names and reformats it into a long format with columns 'Timeframe', 'Marker', 'X', 'Y', 'Z'. Adds a Timeframe column corresponding to each row (time frame) in the original data.

reformat_marker_data(data, convert_to_cm = TRUE)

Arguments

  • data: A data frame containing marker coordinate data for all time frames. Columns should be named in the format 'MXX X', 'MXX Y', 'MXX Z' where 'MXX' is the marker name.
  • convert_to_cm: Logical, if TRUE, divides X, Y, Z coordinates by 10 to convert to centimeters (from millimeters).

Returns

A data frame with columns 'Timeframe', 'Marker', 'X', 'Y', 'Z', sorted by Timeframe and Marker.

Details

The function reshapes the wide-format data into a long format suitable for analysis, adding a Timeframe column that corresponds to each time frame. Optionally converts units to centimeters.

Examples

data(sample_data) reformat_data <- reformat_marker_data(head(sample_data), convert_to_cm = TRUE) head(reformat_data)
  • Maintainer: Wai-Hang Kwong
  • License: MIT + file LICENSE
  • Last published: 2025-01-24

Useful links