| print.athletemonitoring | R Documentation |
prepare resultsThis function prints short summary of the athletemonitoring object
## S3 method for class 'athletemonitoring'
print(x, ...)
x |
Object of class |
... |
Extra arguments. Not used |
# Load monitoring data set
data("monitoring")
# Filter out only 'Training Load'
monitoring <- monitoring[monitoring$Variable == "Training Load", ]
# Convert column to date format (or use numeric)
monitoring$Date <- as.Date(monitoring$Date, "%Y-%m-%d")
# Run the athlete monitoring data preparation
prepared_data <- prepare(
data = monitoring,
athlete = "Full Name",
date = "Date",
variable = "Variable",
value = "Value",
acute = 7,
chronic = 42,
# How should be missing entry treated?
# What do we assume? Zero load? Let's keep NA
NA_session = NA,
# How should missing days (i.e. no entries) be treated?
# Here we assume no training, hence zero
NA_day = 0,
# How should be multiple day entries summarised?
# With "load", it is a "sum", witho other metrics that
# do not aggregate, it can me "mean"
day_aggregate = function(x) {
sum(x, na.rm = TRUE)
},
# Rolling estimators for Acute and Chronic windows
rolling_estimators = function(x) {
c(
"mean" = mean(x, na.rm = TRUE),
"sd" = sd(x, na.rm = TRUE),
"cv" = sd(x, na.rm = TRUE) / mean(x, na.rm = TRUE)
)
},
# Additional estimator post-rolling
posthoc_estimators = function(data) {
data$ACD <- data$acute.mean - data$chronic.mean
data$ACR <- data$acute.mean / data$chronic.mean
data$ES <- data$ACD / data$chronic.sd
# Make sure to return the data
return(data)
},
# Group summary estimators
group_summary_estimators = function(x) {
c(
"median" = median(x, na.rm = TRUE),
"lower" = quantile(x, 0.25, na.rm = TRUE)[[1]],
"upper" = quantile(x, 0.75, na.rm = TRUE)[[1]]
)
}
)
# Get summary
prepared_data
summary(prepared_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.