c3d_setdata {c3dr} | R Documentation |
Write data to a c3d object
Description
Set new data to an existing c3d object.
Usage
c3d_setdata(x, newdata = NULL, newanalog = NULL)
Arguments
x |
A |
newdata |
The new point data that should be written to the |
newanalog |
The new analog data that should be written to the |
Details
This is a basic helper function to allow the modification of data within the
c3dr
package for later export. The function call updates the data (point
and/or analog) and the appropriate parameters and header sections. Note that
not all parameters can be updated based on insufficient information. For
example, when using c3d_setdata()
for updating the point data, the point
label parameter gets updated (based on the column headers), but the point
label descriptions will be unmodified. This can create minor inconsistencies
in the resulting c3d object, which in the worst case can lead to corrupt data
after export with c3d_write()
. If you plan heavy modifications of the data
before export make sure to manually check and update all relevant parameters
as well as the residual data after calling c3d_setdata()
.
Value
The modified c3d object.
Examples
# Import example data
d <- c3d_read(c3d_example())
# remove last frame from point data and analog data (10 subframes for analog)
d_cut <- c3d_data(d)[-340, ]
a_cut <- c3d_analog(d)[-(3391:3400), ]
# write the new c3d object
d_new <- c3d_setdata(d, newdata = d_cut, newanalog = a_cut)
d_new