download_workouts: Download and, optionally, extract the workout archives the...

Description Usage Arguments Details Value References See Also Examples

View source: R/download_workouts.R

Description

Download and, optionally, extract the workout archives the athlete IDs in the remote perspective of a gcod_id object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
download_workouts(
  object,
  local_dir = tempdir(),
  pattern = NULL,
  extract = FALSE,
  mirror = "S3",
  verbose = FALSE,
  confirm = FALSE,
  overwrite = FALSE,
  ...
)

Arguments

object

a character string with the athlete ID or the first few characters of that, or alternatively an object of class gcod_db as produced by get_athlete_ids().

local_dir

the directory to download the workout archives for the selected athlete IDs.

pattern

character string containing a regular expression to be matched with the athlete IDs in object. Only applicable if object is an object of class gcod_db. Default is NULL, which selects all IDs in object.

extract

logical determining whether the workout files in the downloaded archives should be extracted. Default is FALSE. If TRUE, then the archives are extracted in sub-directories under local_dir, named according to the athlete IDs. See Details.

mirror

either "S3" or "OSF", indicating which GoldenCheetah OpenData mirror should be used. Default and recommended is "S3". See Details.

verbose

logical determining whether progress information should be printed. Default is FALSE.

confirm

logical determining whether the user should be asked whether they should continue with the download or not. Default is FALSE.

overwrite

logical determining whether existing archives with the same names as the ones selected for download should be overwritten. Default is FALSE.

...

extra arguments to be passed to aws.s3::save_object().

Details

If extract = TRUE, then extract_workouts() is called with clean_up = TRUE and overwrite = TRUE.

mirror = OSF currently returns an error and will be supported in future versions.

Value

If object is a character string then a gcod_db object is return with corresponding remote and local perspective. If object is an object of class gcod_db, then object is returned with the elements of local_perspective(object)$downloaded set to TRUE or FALSE depending on whether the corresponding workout archives were downloaded successfully or not.

References

Liversedge, M. (2020). GoldenCheetah OpenData Project. OSF. https://doi.org/10.17605/OSF.IO/6HFPZ

See Also

get_athlete_ids() extract_workouts()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Using the first few letters of the athlete ID
if (interactive()) {
  files_007_1 <- download_workouts("007", confirm = TRUE)
}

## Using a `gcod_db` object and fitering using regex
ids_00 <- get_athlete_ids(prefix = "00")
if (interactive()) {
  files_007_2 <- download_workouts(ids_00, pattern = "007", confirm = TRUE)
}

ikosmidis/GoldenCheetahOpenData documentation built on June 3, 2020, 9:25 a.m.