read_ddf reads in workloop, twitch, or tetanus experiment data from .ddf files.

read_ddf(file_name, file_id = NA, rename_cols = list(c(2, 3),
  c("Position", "Force")), skip_cols = 4:11, phase_from_peak = FALSE,



A .ddf file that contains data from a single workloop, twitch, or tetanus experiment


A string identifying the experiment. The file name is used by default.


List consisting of a vector of indices of columns to rename and a vector of new column names. See Details.


Numeric vector of column indices to skip. See Details.


Logical, indicating whether percent phase of stimulation should be recorded relative to peak length or relative to L0 (default)


Additional arguments passed to/from other functions that work with read_ddf()


An object of class workloop, twitch, or tetanus, all of which inherit class muscle_stim. These objects behave like data.frames in most situations but also store metadata from the ddf as attributes.

The muscle_stim object's columns contain:




Length change of the muscle, uncorrected for gear ratio


Force, uncorrected for gear ratio


When stimulation occurs, on a binary scale

In addition, the following information is stored in the data.frame's attributes:

Frequency at which samples were collected


Number of sequential pulses within a stimulation train


Total number of oscillatory cycles (assuming sine wave trajectory) that the muscle experienced. Cycles are defined with respect to initial muscle length (L0-to-L0 as opposed to peak-to-peak).


amplitude of length change (again, assuming sine wave trajectory)


Frequency of oscillations (again, assuming sine wave trajectory)


The units of measurement for each column in the data.frame. This might be the most important attribute so please check that it makes sense!


Read in a .ddf file that contains data from an experiment. If position and force do not correspond to columns 2 and 3 (respectively), replace "2" and "3" within rename_cols accordingly. Similarly, skip_cols = 4:11 should be adjusted if more than 11 columns are present and/or columns 4:11 contain important data.

Please note that there is no correction for gear ratio or further manipulation of data. See fix_GR to adjust gear ratio. Gear ratio can also be adjusted prior to analyses within the analyze_workloop() function, the data import all-in-one function read_analyze_wl(), or the batch analysis all-in-one read_analyze_wl_dir().

Please also note that organization of data within the .ddf file is assumed to conform to that used by Aurora Scientific's Dynamic Muscle Control and Analysis Software. YMMV if using a .ddf file from another source. The as_muscle_stim() function can be used to generate muscle_stim objects if data are imported via another function. Please feel free to contact us with any issues or requests.

See also


library(workloopR) # import the workloop.ddf file included in workloopR wl_dat <-read_ddf(system.file("extdata", "workloop.ddf", package = 'workloopR'), phase_from_peak = TRUE) # or import your own file if (FALSE) { my_dat <- read_ddf("./my/file/path/myfile.ddf") }