c3d_data {c3dr} | R Documentation |
Get point data from a c3d object
Description
Get the point data of an c3d object in a data frame.
Usage
c3d_data(x, format = "wide")
Arguments
x |
A c3d object, as imported by |
format |
Either |
Details
The point data of imported c3d objects in c3dr
is saved as a list of lists.
This is good for internal handling, but for analysis a table format (a data
frame) is often more convenient.c3d_data()
returns the point data from an
imported c3d object as a data frame.
Analyses of data frames may require them to have different formats. For
c3d_data
output, different data formats ("wide"
, "long"
, "longest"
)
are available. See the section below for more details. You can convert
between different formats with c3d_convert()
.
Value
A data frame of class c3d_data
with the c3d point data. The
structure of the data frame depends on 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())
# wide format (default)
w <- c3d_data(d)
head(w)
# long format
l <- c3d_data(d, format = "long")
head(l)
# longest format
ll <- c3d_data(d, format = "longest")
head(ll)