readX {trackeR}R Documentation

Read a training file in tcx, gpx, db3 or Golden Cheetah's JSON format

Description

Read a training file in tcx, gpx, db3 or Golden Cheetah's JSON format

Usage

readTCX(file, timezone = "", speedunit = "m_per_s", distanceunit = "m", ...)

readGPX(file, timezone = "", speedunit = "km_per_h", distanceunit = "km", ...)

readDB3(
  file,
  timezone = "",
  table = "gps_data",
  speedunit = "km_per_h",
  distanceunit = "km",
  ...
)

readJSON(file, timezone = "", speedunit = "km_per_h", distanceunit = "km", ...)

Arguments

file

The path to a tcx, gpx, json or db3 file. Compressed versions (gz, bz2, xz, zip) of tcx, gpx, and json files are directly supported.

timezone

The timezone of the observations as passed on to as.POSIXct. Ignored for JSON files.

speedunit

Character string indicating the measurement unit of the speeds in the container file to be converted into meters per second. See Details.

distanceunit

Character string indicating the measurement unit of the distance in the container file to be converted into meters. See Details.

...

Currently not used.

table

Character string indicating the name of the table with the GPS data in the db3 container file.

Details

Available options for speedunit currently are km_per_h, m_per_s, mi_per_h, ft_per_min and ft_per_s. The default is m_per_s for TCX files and km_per_h for db3 and Golden Cheetah's json files. Available options for distanceunit currently are km, m, mi and ft. The default is m for TCX and km for gpx, db3 and Golden Cheetah's json files.

readTCX, readGPX, readGPX and readDB3, try to identify the sport from the data in the container file. If that fails, then an attempt is made to guess the sport from keywords in the filename. If identification is not possible then the file attribute of the returned object has value NA.

Reading Golden Cheetah's JSON files is experimental.

Examples

## read raw data
filepath <- system.file("extdata/tcx", "2013-06-08-090442.TCX.gz", package = "trackeR")
run0 <- readTCX(file = filepath, timezone = "GMT")

## turn into trackeRdata object
units0 <- generate_units()
run0 <- trackeRdata(run0, units = units0)

## alternatively
## Not run: 
run0 <- read_container(filepath, type = "tcx", timezone = "GMT")

## End(Not run)


[Package trackeR version 1.6.0 Index]