Learn R Programming

rStrava (version 1.3.1)

get_activity_streams: Retrieve streams for activities, and convert to a dataframe

Description

Retrieve streams for activities, and convert to a dataframe.

Usage

get_activity_streams(act_data, ...)

# S3 method for list get_activity_streams( act_data, stoken, acts = NULL, id = NULL, types = NULL, resolution = "high", series_type = "distance", ... )

# S3 method for actframe get_activity_streams( act_data, stoken, types = NULL, resolution = "high", series_type = "distance", ... )

Value

A stream frame object (strframe that includes a data frame for the stream data along with the units

Arguments

act_data

an list object returned by get_activity_list or a data.frame returned by compile_activities

...

arguments passed to or from other methods

stoken

A config object created using the strava_oauth function

acts

numeric indicating which activities to compile starting with most recent, defaults to all

id

optional numeric vector to specify the id(s) of the activity/activities to plot, acts is ignored if provided

types

list indicating which streams to get for each activity, defaults to all available, see details.

resolution

chr string for the data resolution to retrieve, can be "low", "medium", "high", defaults to all

series_type

chr string for merging the data if resolution is not equal to "all". Accepted values are "distance" (default) or "time".

Author

Lorenzo Gaborini

Details

Each activity has a value for every column present across all activities, with NAs populating missing values.

For the types argument, the default is type = NULL which will retrieve all available stream types. The available stream types can be any of time, latlng, distance, altitude, velocity_smooth, heartrate, cadence, watts, temp, moving, or grade_smooth. To retrieve only a subset of the types, pass a list argument with the appropriate character strings to type, e.g., type = list("time", "latlng", "distance").

Examples

Run this code
 
if (FALSE) {
stoken <- httr::config(token = strava_oauth(app_name, app_client_id, app_secret, cache = TRUE))

my_acts <- get_activity_list(stoken) 

strms_data <- get_activity_streams(my_acts, stoken, acts = 1:2)

}

Run the code above in your browser using DataLab