Learn R Programming

rStrava (version 1.0.0)

get_elev_prof: Create elevation profiles from activity data

Description

Create elevation profiles from activity data

Usage

get_elev_prof(act_data, ...)

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

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

# S3 method for 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

key

chr string of Google API key for elevation data, passed to 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

Value

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

Details

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

See Also

get_dists

Examples

Run this code
# 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)
# }

Run the code above in your browser using DataLab