parse_tcx {activatr}R Documentation

Parses a TCX file into a tibble.

Description

This parses a standard Training Center XML (TCX) file into an act_tbl.

Usage

parse_tcx(filename, detail = c("basic", "latlon", "advanced"), every = NA)

Arguments

filename

The TCX file to parse

detail

How much detail to parse from the TCX. * If "basic", the default, this will load lat / lon / ele / time. * If "latlon", it will only load lat/lon: useful for TCX files exported without time information. * If "advanced", it will load everything from basic, plus hr / cad / atemp: useful for files with HR information.

every

Optional. If provided, determines how frequently points will be sampled from the file, so if 10 is provided, every tenth point will be selected. If omitted or set to 1, every point will be selected. Must be a positive integer.

Value

A act_tbl with one row for each trackpoint in the TCX (modified by every), and with the columns determined by detail.

lat

latitude, a dbl in degrees between -90 and 90

lon

longitude, a dbl in degrees between -180 and 180

ele

elevation, a dbl in meters

time

time, a dttm representing the time of the point

hr

heart rate, an int in beats per minute

cad

cadence, an int in one-foot steps per minute

Additionally, attributes are set on the tibble containing top level data from the TCX. Each of these will be NA when not provided in the file.

filename

the filename this was parsed from. This is always present is always the value of the filename argument.

time

time, a dttm representing the time of the TCX

type

type, a chr

See Also

https://en.wikipedia.org/wiki/Training_Center_XML

Examples

running_file <- system.file(
  "extdata",
  "running_example.tcx.gz",
  package = "activatr"
)
running_df <- parse_gpx(running_file)

[Package activatr version 0.1.0 Index]