calculate_ef: Calculate Efficiency Factor (EF) Data

View source: R/calculate_ef.R

calculate_efR Documentation

Calculate Efficiency Factor (EF) Data

Description

Calculates Efficiency Factor (Pace/HR or Power/HR) from Strava activities.

Usage

calculate_ef(
  stoken,
  activity_type = c("Run", "Ride"),
  ef_metric = c("Pace_HR", "Power_HR"),
  start_date = NULL,
  end_date = NULL,
  min_duration_mins = 20
)

Arguments

stoken

A valid Strava token object obtained using rStrava::strava_oauth().

activity_type

Character vector or single string specifying activity type(s).

ef_metric

Character string specifying the EF metric ("Pace_HR" or "Power_HR").

start_date

Optional start date (YYYY-MM-DD string or Date object). Defaults to one year ago.

end_date

Optional end date (YYYY-MM-DD string or Date object). Defaults to today.

min_duration_mins

Numeric, minimum activity duration in minutes. Default 20.

Details

Fetches activity summaries and calculates EF (output/HR) for each. Provides the data used by 'plot_ef'.

Value

A data frame with columns: date, activity_type, ef_value.

Examples

# Example using simulated data
data(Athlytics_sample_data)
print(head(athlytics_sample_ef))

## Not run: 
# Example using real data (requires authentication)
# To authenticate (replace with your details):
# stoken <- rStrava::strava_oauth(app_name = "YOUR_APP",
#                                client_id = "YOUR_ID",
#                                client_secret = "YOUR_SECRET",
#                                cache = TRUE)

# Calculate Pace/HR efficiency factor for Runs
# Ensure stoken is defined and valid before running this part
# ef_data_run <- calculate_ef(stoken = stoken, activity_type = "Run", ef_metric = "Pace_HR")
# print(tail(ef_data_run))

# Calculate Power/HR efficiency factor for Rides
# Ensure stoken is defined and valid before running this part
# ef_data_ride <- calculate_ef(stoken = stoken, activity_type = "Ride", ef_metric = "Power_HR")
# print(tail(ef_data_ride))

## End(Not run)

Athlytics documentation built on June 8, 2025, 1:11 p.m.