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

View source: R/get_activity_streams.R

get_activity_streamsR Documentation

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 class 'list'
get_activity_streams(
  act_data,
  stoken,
  acts = NULL,
  id = NULL,
  types = NULL,
  resolution = "high",
  series_type = "distance",
  ...
)

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

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".

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").

Value

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

Author(s)

Lorenzo Gaborini

Examples

 
## Not run: 
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)


## End(Not run)

fawda123/rStrava documentation built on March 27, 2024, 3:16 p.m.