get_elev_prof {rStrava}R Documentation

Create elevation profiles from activity data

Description

Create elevation profiles from activity data

Usage

get_elev_prof(act_data, ...)

## S3 method for class 'list'
get_elev_prof(
  act_data,
  acts = 1,
  id = NULL,
  key,
  total = FALSE,
  expand = 10,
  units = "metric",
  fill = "darkblue",
  ...
)

## S3 method for class 'actframe'
get_elev_prof(
  act_data,
  key,
  total = FALSE,
  expand = 10,
  fill = "darkblue",
  ...
)

## S3 method for class 'strframe'
get_elev_prof(act_data, total = FALSE, expand = 10, fill = "darkblue", ...)

Arguments

act_data

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

...

arguments passed to or from other methods

acts

numeric value indicating which elements of act_data to plot, defaults to most recent

id

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

key

chr string of Google API key for elevation data, passed to google_elevation, see details

total

logical indicating if elevations are plotted as cumulative climbed by distance

expand

a numeric multiplier for expanding the number of lat/lon points on straight lines. This can create a smoother elevation profile. Set expand = 1 to suppress this behavior.

units

chr string indicating plot units as either metric or imperial, this has no effect if input data are already compiled with compile_activities

fill

chr string of fill color for profile

Details

The Google API key is easy to obtain, follow instructions here: https://developers.google.com/maps/documentation/elevation/#api_key

Value

A ggplot of elevation profiles, facetted by activity id, date

Author(s)

Daniel Padfield, Marcus Beck

See Also

get_dists

Examples

## Not run: 
# get my activities
stoken <- httr::config(token = strava_oauth(app_name, app_client_id, app_secret, cache = TRUE))
my_acts <- get_activity_list(stoken)

# your unique key
mykey <- 'Get Google API key'
get_elev_prof(my_acts, acts = 1:2, key = mykey)

# compile first, change units
my_acts <- compile_activities(my_acts, acts = c(1:2), units = 'imperial')
get_elev_prof(my_acts, key = mykey)

## End(Not run)

[Package rStrava version 1.3.1 Index]