import_ride: Ride file parsing

Description Usage Arguments Details Value Notes Acknowledgements See Also Examples

Description

The generic import_ride dispatches methods based on the file extension of file_path. See Details for currently supported file formats. The default method (i.e. for unsupported formats) will raise an error.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import_ride(file_path, ...)

## S3 method for class 'fit'
import_ride(file_path, raw = FALSE, make_laps = TRUE, ...)

## S3 method for class 'pwx'
import_ride(file_path, ...)

## S3 method for class 'tcx'
import_ride(file_path, make_laps = TRUE, ...)

## S3 method for class 'gpx'
import_ride(file_path, ...)

## S3 method for class 'srm'
import_ride(file_path, ...)

Arguments

file_path

character string; path to the file to be read. Can be absolute or relative.

...

further arguments passed to or from other methods.

raw

logical; if TRUE all data retrieved from the fit file is returned as a list. raw = FALSE (default) will just return formatted "records", which are generally what's expected/of interest.

make_laps

logical; append a lap column to the data (if available)?

Details

These functions will do very little with the parsed data by default. This is to allow for more flexibility, but can cause headaches for batch analysing files of mixed formats (see clean_bikedata for a solution).

Timestamps are converted to POSIXct when available.

Currently supported formats are:

Tabular data are always returned as dplyr tbl objects. This ensures clean printing and makes data easier to work with.

Value

With very few exceptions, these functions return data as a tbl_df, with the additional attribute "file_ext".

Notes

Garmin Fit files return positional coordinates in units of semicircles. These are converted to degrees by default (if raw = FALSE).

Acknowledgements

XML file formats are parsed using the pugixml C++ library.

SRM parsing code was adapted from the code in the Golden Cheetah repository (which can be found here).

See Also

clean_bikedata for creating consistent output from these functions.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
ride_files <- list.files(
  system.file("extdata", package = "elpatron"),
  full.names = TRUE)

(f <- sample(ride_files, 1))
import_ride(f)

## If you want all data from the .fit format...
f <- grep("fit$", ride_files, value = TRUE)
import_ride(f, raw = TRUE)

## End(Not run)

jmackie4/elpatron documentation built on May 19, 2019, 12:49 p.m.