Learn R Programming

cycleRtools (version 1.0.0)

read: Read cycling device data.

Description

Read data from a cycling head unit into the R environment; optionally formatting it for use with other functions in this package.

Usage

read(file, format = TRUE, .list = FALSE)

read_fit(file, format = TRUE)

read_pwx(file, format = TRUE, .list = FALSE)

read_pwx2(file, format = TRUE, .list = FALSE)

read_srm(file, format = TRUE)

read_tcx2(file, format = TRUE, .list = FALSE)

Arguments

file
character; path to the file.
format
logical; should data be formatted?
.list
should data be returned as a list? Useful when data columns are of unequal length, as can sometimes be the case with read_pwx and read_tcx.

Value

  • A data frame or list, according to the .list argument.

Functions

  • read: A wrapper for read_* functions that chooses the appropriate function based on file extension.
  • read_fit: Read a Garmin (Ltd) device .fit file. This invokes the systemjavacommand to execute the FitCSVTool.jar from thehttp://www.thisisant.com/resources/fit{FIT SDK}. Hence, this function requires that Java (JRE/JDK) binaries be on the system path.
  • read_pwx: Read a Training Peaks .pwx file. Requires the "XML" package to be installed.read_pwx2is a faster alternative that uses system commands.
  • read_pwx2: Read a Training Peaks .pwx file. Requires the command line tool "xml2" to be installed.
  • read_srm: Read an SRM (.srm) file. This requireshttp://www.zuto.de/project/srmio/{Rainer Clasen's srmio library} to be installed and on the system path.
  • read_tcx2: Read a Garmin .tcx file. Fast and dirty command line parsing. Requires the command line tool "xml2" to be installed.

Details

Returns a data frame with all data parsed from the file; with an additional lap (factor) column appended in the case of read_fit().

Note that most functions within this package depend on imported data being formatted; i.e. read*("file_path", format = TRUE). Hence, unless the raw data is of particular interest and/or the user wants to process it manually, the format argument should be TRUE (default). When working with a formatted dataset, do not change existing column names. The formatted structure is described in detail in cycling_data.