trackeR (version 1.5.2)

read_directory: Read all supported container files from a supplied directory

Description

Read all supported container files from a supplied directory

Usage

read_directory(directory, aggregate = FALSE, table = "gps_data",
  timezone = "", session_threshold = 2, smooth_elevation_gain = TRUE,
  correct_distances = FALSE, country = NULL, mask = TRUE,
  from_distances = NULL, speedunit = list(tcx = "m_per_s", gpx =
  "km_per_h", db3 = "km_per_h", json = "km_per_h"),
  distanceunit = list(tcx = "m", gpx = "km", db3 = "km", json = "km"),
  sport = NULL, lgap = 30, lskip = 5, m = 11, silent = FALSE,
  parallel = FALSE, verbose = TRUE)

readDirectory(directory, aggregate = FALSE, table = "gps_data", timezone = "", session_threshold = 2, smooth_elevation_gain = TRUE, correct_distances = FALSE, country = NULL, mask = TRUE, from_distances = NULL, speedunit = list(tcx = "m_per_s", gpx = "km_per_h", db3 = "km_per_h", json = "km_per_h"), distanceunit = list(tcx = "m", gpx = "km", db3 = "km", json = "km"), sport = NULL, lgap = 30, lskip = 5, m = 11, silent = FALSE, parallel = FALSE, verbose = TRUE)

Value

An object of class trackeRdata.

Arguments

directory

The path to the directory.

aggregate

Logical. Aggregate data from different files to the same session if observations are less then session_threshold hours apart? Alternatively, data from different files is stored in different sessions.

table

The name of the table in the database for db3 files.

timezone

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

session_threshold

The threshold in hours for the time difference between consecutive timestamps above which they are considered to belong to different training sessions.

smooth_elevation_gain

Logical. Should the elevation gain be smoothed before computing elevation gain? Default is TRUE.

correct_distances

Logical. Should the distances be corrected for elevation? Default is FALSE.

country

ISO3 country code for downloading altitude data. If NULL, country is derived from longitude and latitude

mask

Logical. Passed on to getData. Should only the altitudes for the specified country be extracted (TRUE) or also those for the neighboring countries (FALSE)?

from_distances

Logical. Should the speeds be calculated from the distance recordings instead of taken from the speed recordings directly. Defaults to TRUE for tcx and Golden Cheetah's json files and to FALSE for db3 files.

speedunit

Character string indicating the measurement unit of the speeds in the container file to be converted into meters per second. Default is m_per_s for tcx files and km_per_h for db3 and Golden Cheetah's json files. See Details.

distanceunit

Character string indicating the measurement unit of the distance in the container file to be converted into meters. Default is m for tcx files and km for db3 and Golden Cheetah's json files. See Details.

sport

What sport do the files in directory correspond to? Either 'cycling', 'running', 'swimming' or NULL (default), in which case an attempt is made to extract the sport from each file in directory.

lgap

Time in seconds corresponding to the minimal sampling rate.

lskip

Time in seconds between the last observation before a small break and the first imputed speed or the last imputed speed and the first observation after a small break.

m

Number of imputed observations in each small break.

silent

Logical. Should warnings be generated if any of the sanity checks on the data are triggered?

parallel

Logical. Should reading be carried out in parallel? If TRUE reading is performed in parallel using the backend provided to foreach. Default is FALSE.

verbose

Logical. Should progress reports be printed?

Details

Available options for speedunit currently are km_per_h, m_per_s, mi_per_h, ft_per_min and ft_per_s. Available options for distanceunit currently are km, m, mi and ft.

If aggregate = TRUE, then if sport = NULL the sport in all sessions is determined by the first file read with a sport specification; else if sport is one of the other valid options it determines the sport for all sessions.

See Also

trackeRdata, readTCX, readDB3, readJSON

Examples

Run this code
if (FALSE) {
filepath <- system.file("extdata/gpx", package = "trackeR")
gpx_files <- read_directory(filepath)
}

Run the code above in your browser using DataCamp Workspace