get_athlete_ids: Get information for athlete IDs that are available in the...

Description Usage Arguments Details Value References See Also Examples

View source: R/get_athlete_ids.R

Description

Get information for athlete IDs that are available in the GoldenCheetah OpenData project and organize it in a gcod_db object.

Usage

1
get_athlete_ids(n_ids = Inf, mirror = "S3", prefix = NULL, ...)

Arguments

n_ids

integer indicating the maximum number of athlete IDs to return. Default is Inf, which will return all available athlete IDs.

mirror

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

prefix

character string that limits the response to athlete IDs that begin with it. Default is NULL, which does not limit responses.

...

further options to be passed to [aws.s3::get_bucket_df()].

Details

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

Value

A list also inheriting from class gcod_db with components remote_db (the "remote perspective"; of class gcod_remote_db) and local_db ("the local perspective"; of class gcod_local_db). remote_db and local_db are data.frames, also inheriting from classes gcod_remote_db and gcod_local_db, respectively. local_db has variables "path", "last_modified", "size", "extracted", "downloaded", "athlete_id"m and remote_db has variables "key", "last_modified", "e_tag", "size", "owner_id", "owner_display_name", "storage_class", "bucket", and "athlete_id".

References

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

See Also

print.gcod_db() min_size.gcod_db() max_size.gcod_db() total_size.gcod_db() mean_size.gcod_db() n_ids.gcod_db() remote_perspective.gcod_db() local_perspective.gcod_db()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Get details for all available athlete IDs
ids <- get_athlete_ids()
## Print basic info for the IDs retrieved
print(ids, txtplot = TRUE)

## Extract basic info for the IDs retrieved
n_ids(ids, perspective = "remote")
n_ids(ids, perspective = "local")
format(min_size(ids, perspective = "local"), unit = "auto")
format(min_size(ids, perspective = "remote"), unit = "auto")
format(max_size(ids), unit = "auto")
format(mean_size(ids), unit = "auto")
format(total_size(ids), unit = "auto")

## remote_perspective(ids) and local_perspective(ids) inherit from
## data.frame` so we can easily do stuff like

## find which IDs have the minimum/maximum sizes
remote_ids <- remote_perspective(ids)
remote_ids[which.min(remote_ids$size), "athlete_id"]
## find all IDs with the string "007"
subset(athlete_id(ids), grepl("007", athlete_id(ids)))
## etc

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