c3d_convert {c3dr} | R Documentation |
Convert between c3d point data formats
Description
Convert between different representations of point data in c3d files.
Usage
c3d_convert(data, format)
Arguments
data |
A data frame of class |
format |
Either |
Value
A data frame of class c3d_data
in the format specified by the
format
argument.
Data Formats
Wide
The wide format has three numeric columns per point (x, y, z). The column
names have the structure pointname_type
, so for example the x-coordinate of
a point named C7
has the name C7_x
. Each row corresponds to one recording
frame.
Long
The long format has one column per point. The column names correspond to the
names of the points. Each recording frame corresponds to three rows of data
(x, y, z). In additional to the point columns containing numeric data there
are two additional columns: One that indicates the frame number (frame
,
numeric) and one that indicates the coordinate type (type
, either x, y, or
z, as a character).
Longest
The longest format has one data column (value
, numeric). The other columns
indicate the frame number (frame
, numeric), the coordinate type (type
,
either x, y, or z, as a character), and the point name (point
, character).
Thus, each row of the data frame corresponds to one data entry.
Examples
# Import example data
d <- c3d_read(c3d_example())
# get point data in wide format
w <- c3d_data(d, format = "wide")
# convert to long data
l <- c3d_convert(w, "long")
head(l)