parse_tcx | R Documentation |
act_tbl
This parses a standard Training Center XML (TCX) file into a
data frame with class act_tbl
. See vignette("parsing")
for examples.
parse_tcx(filename, detail = c("basic", "latlon", "advanced"), every = NA)
filename |
The TCX file to parse |
detail |
How much detail to parse from the TCX
|
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. This is most useful to quickly analyze a large file, since parsing is much faster when skipping 90% of the data points. |
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 double in degrees between -90 and 90. |
lon |
Longitude, a double in degrees between -180 and 180. |
ele |
Elevation, a double in meters. |
time |
A date-time 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, a string. This is always
present, and is always the value of the |
time |
A date-time representing the time of the activity. |
type |
A string. |
https://en.wikipedia.org/wiki/Training_Center_XML
example_tcx_file <- system.file(
"extdata",
"running_example.tcx.gz",
package = "activatr"
)
act_tbl <- parse_tcx(example_tcx_file)
print(act_tbl, n = 5)
attr(act_tbl, "title")
nrow(parse_tcx(example_tcx_file))
nrow(parse_tcx(example_tcx_file, every = 100))
colnames(parse_tcx(example_tcx_file))
colnames(parse_tcx(example_tcx_file, detail = "latlon"))
colnames(parse_tcx(example_tcx_file, detail = "advanced"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.