Calculates Efficiency Factor (Pace/HR or Power/HR) from Strava activities.
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`.
Examples
# 使用模拟数据示例 (注意: 模拟数据本身已是计算结果, 此处仅作演示)
data(Athlytics_sample_data)
if (!is.null(athlytics_sample_ef)) {
print(head(athlytics_sample_ef))
}
#> date activity_type ef_value
#> 1 2025-03-19 Run 0.01681271
#> 2 2025-03-15 Run 0.01879990
#> 3 2025-03-09 Run 0.01951791
#> 4 2025-02-27 Run 0.02125833
#> 5 2025-02-21 Run 0.02178707
#> 6 2025-02-20 Run 0.01802687
# \donttest{
# 使用真实数据的示例(需要认证)
stoken <- rStrava::strava_oauth(..., cache = TRUE)
#> Error: '...' used in an incorrect context
# 计算跑步的Pace/HR效率因子
ef_data_run <- calculate_ef(stoken = stoken, activity_type = "Run", ef_metric = "Pace_HR")
#> Error: object 'stoken' not found
print(tail(ef_data_run))
#> Error: object 'ef_data_run' not found
# 计算骑行的Power/HR效率因子
ef_data_ride <- calculate_ef(stoken = stoken, activity_type = "Ride", ef_metric = "Power_HR")
#> Error: object 'stoken' not found
print(tail(ef_data_ride))
#> Error: object 'ef_data_ride' not found
# }