Learn R Programming

vald.extractor (version 0.1.1)

plot_vald_trends: Time-Series Visualization of Performance Metrics

Description

Creates professional line plots showing how performance metrics change over time for individual athletes or groups. Useful for tracking training adaptations, injury recovery, and seasonal trends.

Usage

plot_vald_trends(
  data,
  date_col = "Testdate",
  metric_col,
  group_col = NULL,
  facet_col = NULL,
  title = NULL,
  smooth = FALSE
)

Value

A ggplot2 object.

Arguments

data

Data frame. Test data with a date column and at least one metric.

date_col

Character. Name of the date column. Default is "Testdate".

metric_col

Character. Name of the metric to plot.

group_col

Character. Optional grouping variable (e.g., "profileId", "sports"). If provided, separate lines are drawn for each group.

facet_col

Character. Optional faceting variable (e.g., "sex"). Creates separate panels for each level.

title

Character. Plot title. If NULL, auto-generates from metric name.

smooth

Logical. If TRUE, adds a smoothed trend line. Default is FALSE.

Details

Plot Longitudinal Trends for VALD Metrics

Examples

Run this code
# \donttest{
if (FALSE) {
  test_datasets <- split_by_test(final_analysis_data)

  # Plot individual athlete trends
  plot_vald_trends(
    data = test_datasets$CMJ,
    metric_col = "PEAK_FORCE_Both",
    group_col = "profileId",
    facet_col = "sex"
  )

  # Plot sport-level averages
  sport_avg <- test_datasets$CMJ %>%
    group_by(Testdate, sports) %>%
    summarise(avg_force = mean(PEAK_FORCE_Both, na.rm = TRUE))

  plot_vald_trends(
    data = sport_avg,
    date_col = "Testdate",
    metric_col = "avg_force",
    group_col = "sports"
  )
}
# }

Run the code above in your browser using DataLab