clean_bikedata: Clean raw cycling device data.

Description Usage Arguments Details Value Clean structure Examples

Description

These functions implement a consistent and predictable column structure for incoming cycling device data. This should permit, where necessary, batch operations on various different file formats. See below for details of this structure.

Usage

1

Arguments

data

ride data (from import_ride) to be "cleaned".

...

arguments to be passed to select.

Details

Note that these functions do not retain any of the original data columns. If extra columns want to be retained, extra arguments can be passed down to select via ...

If any required columns are missing in the original data, those columns of the specification (below) that depend on them will still be returned, but filled with NAs.

When imported with import_ride, the returned data is given a file extension attribute. This attribute is the basis for method dispatch here.

Value

a tbl_df with the column structure as described above, with a "start_time" attribute appended where available.

Clean structure

In general, fields should be named as "field.units", where the field is generally written in full. Time derivatives should be adjacent to their "parent" (e.g. distance, speed; work, power). If data for any of these columns are missing the column should be included, but filled with NAs. The SI unit system should be adhered to.

time.s

Elapsed time since the start of recording, in seconds. Should not start at 0.

lon, lat

Positional coordinates in degrees. Keeping these fields in lon,lat order is in keeping with the x,y convention.

distance.km, speed.kmh

Self-explanatory: cumulative distance covered (kilometres) and speed (kilometres per hour).

elevation.m, VAM

Metres above sea level and "vertical ascent metres per second".

work.kJ, power.W

Self-explanatory: cumulative work done (kilojoules) and power output (Watts).

cadence.rpm

Pedal (angular) velocity in revolutions per minute.

hr.bpm

Heart rate in beats per minute.

temp.C

Ambient temperature in degrees Celsius.

lap

A lap counter, starting from 1.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
ride_file <- system.file("extdata/lufbra.fit", package = "elpatron")

parsed_ride <- import_ride(ride_file, make_laps = TRUE)

## Simple cleaning:
clean_bikedata(parsed_ride)

## We can also make use of dplyr's select_helpers
## (see ?dplyr::select_helpers)

library(dplyr, warn.conflicts = FALSE)
clean_bikedata(parsed_ride, contains("torque"))

## Trying to hold on to non-existent fields won't throw errors.
clean_bikedata(parsed_ride, contains("epo_concentration"))

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