Calculate Training Load Exposure (ATL, CTL, ACWR)
Source:R/calculate_exposure.R
calculate_exposure.Rd
Calculates training load metrics like ATL, CTL, and ACWR from Strava data.
Usage
calculate_exposure(
stoken,
activity_type = c("Run", "Ride", "VirtualRide", "VirtualRun"),
load_metric = "duration_mins",
acute_period = 7,
chronic_period = 42,
user_ftp = NULL,
user_max_hr = NULL,
user_resting_hr = NULL,
end_date = NULL
)
Arguments
- stoken
A valid Strava token from `rStrava::strava_oauth()`.
- activity_type
Type(s) of activities to include (e.g., "Run", "Ride"). Default includes common run/ride types.
- load_metric
Method for calculating daily load (e.g., "duration_mins", "distance_km", "tss", "hrss"). Default "duration_mins".
- acute_period
Days for the acute load window (e.g., 7).
- chronic_period
Days for the chronic load window (e.g., 42). Must be greater than `acute_period`.
- user_ftp
Required if `load_metric = "tss"`. Your Functional Threshold Power.
- user_max_hr
Required if `load_metric = "hrss"`. Your maximum heart rate.
- user_resting_hr
Required if `load_metric = "hrss"`. Your resting heart rate.
- end_date
Optional. Analysis end date (YYYY-MM-DD string or Date). Defaults to today. The analysis period covers the `chronic_period` days ending on this date.
Value
A data frame with columns: `date`, `daily_load`, `atl` (Acute Load), `ctl` (Chronic Load), and `acwr` (Acute:Chronic Ratio) for the analysis period.
Details
Calculates daily load, ATL, CTL, and ACWR from Strava activities based on the chosen metric and periods.
Provides data for `plot_exposure`. Fetches extra prior data for accurate initial CTL. Requires FTP/HR parameters for TSS/HRSS metrics.
Examples
# 使用模拟数据示例 (注意: 模拟数据本身已是计算结果, 此处仅作演示)
data(Athlytics_sample_data)
if (!is.null(athlytics_sample_exposure)) {
print(head(athlytics_sample_exposure))
}
#> # A tibble: 6 × 5
#> date daily_load ctl atl acwr
#> <date> <dbl> <dbl> <dbl> <dbl>
#> 1 2025-03-27 0 5.98 0 0
#> 2 2025-03-28 0 5.98 0 0
#> 3 2025-03-29 0 5.44 0 0
#> 4 2025-03-30 0 5.44 0 0
#> 5 2025-03-31 0 5.44 0 0
#> 6 2025-04-01 0 5.44 0 0
# \donttest{
# 使用真实数据的示例(需要认证)
stoken <- rStrava::strava_oauth(..., cache = TRUE)
#> Error: '...' used in an incorrect context
# 使用TSS计算骑行的训练负荷
ride_exposure_tss <- calculate_exposure(
stoken = stoken,
activity_type = "Ride",
load_metric = "tss",
user_ftp = 280,
acute_period = 7,
chronic_period = 28
)
#> Error: object 'stoken' not found
print(head(ride_exposure_tss))
#> Error: object 'ride_exposure_tss' not found
# 使用HRSS计算跑步的训练负荷
run_exposure_hrss <- calculate_exposure(
stoken = stoken,
activity_type = "Run",
load_metric = "hrss",
user_max_hr = 190,
user_resting_hr = 50
)
#> Error: object 'stoken' not found
print(tail(run_exposure_hrss))
#> Error: object 'run_exposure_hrss' not found
# }