This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.
# Define custom MLS theme with black background theme_mls <- function() { theme_minimal(base_size = 13) + theme( plot.background = element_rect(fill = “black”, color = “black”), # Set plot background to black panel.background = element_rect(fill = “black”, color = “black”), # Set panel background to black plot.title = element_text(face = “bold”, size = 16, color = “white”), # White title plot.subtitle = element_text(size = 12, color = “gray90”), # Light gray subtitle plot.caption = element_text(size = 10, face = “italic”, color = “gray80”), # Lighter caption color axis.title = element_text(face = “bold”, color = “white”), # White axis titles axis.text = element_text(color = “white”), # White axis text legend.title = element_text(color = “white”), # White legend title legend.text = element_text(color = “white”), # White legend text legend.position = “top”, panel.grid.major = element_line(color = “gray30”), # Darker grid lines for contrast panel.grid.minor = element_blank() ) }
plot1 <- ggboxplot(msc_data, x = “Altitude_code”, y = “Soreness_1”, color = “Altitude_code”, add = “jitter”, add.params = list(alpha = 0.3), ylab = “Soreness”, xlab = “Altitude Code”) + stat_compare_means(method = “t.test”) + labs(title = “RPE Legs vs Soreness”) + theme_mls() # Apply MLS theme with black background
plot2 <- ggboxplot(msc_data, x = “Altitude_code”, y = “Soreness_1”, color = “Altitude_code”, add = “jitter”, add.params = list(alpha = 0.3), ylab = “Soreness”, xlab = “Altitude Code”) + stat_compare_means(method = “t.test”) + labs(title = “RPE Breathe vs Soreness”) + theme_mls() # Apply MLS theme with black background
combined_mls_plot <- plot1 | plot2
combined_mls_plot
plot3 <- ggboxplot(msc_data, x = “Altitude_code”, y = “HighSpeedRunning”, color = “Altitude_code”, add = “jitter”, add.params = list(alpha = 0.3), ylab = “High-Speed Running”, xlab = “Altitude Code”) + stat_compare_means(method = “t.test”) + labs(title = “High-Speed Running vs RPE Legs”) + theme_mls() # Apply MLS theme with black background
plot4 <- ggboxplot(msc_data, x = “Altitude_code”, y = “HighSpeedRunning”, color = “Altitude_code”, add = “jitter”, add.params = list(alpha = 0.3), ylab = “High-Speed Running”, xlab = “Altitude Code”) + stat_compare_means(method = “t.test”) + labs(title = “High-Speed Running vs RPE Breathe”) + theme_mls() # Apply MLS theme with black background
combined_mls_plot_3_4 <- plot3 | plot4
combined_mls_plot_3_4
plot5 <- ggboxplot(msc_data, x = “Altitude_code”, y = “Duration”, color = “Altitude_code”, add = “jitter”, add.params = list(alpha = 0.3), ylab = “Session Duration (min)”, xlab = “Altitude Code”) + stat_compare_means(method = “t.test”) + labs(title = “Session Duration vs RPE Legs”) + theme_mls() # Apply MLS theme with black background
plot6 <- ggboxplot(msc_data, x = “Altitude_code”, y = “Duration”, color = “Altitude_code”, add = “jitter”, add.params = list(alpha = 0.3), ylab = “Session Duration (min)”, xlab = “Altitude Code”) + stat_compare_means(method = “t.test”) + labs(title = “Session Duration vs RPE Breathe”) + theme_mls() # Apply MLS theme with black background
combined_mls_plot_5_6 <- plot5 | plot6
combined_mls_plot_5_6
library(tidyr) library(ggplot2)
msc_data_rpe <- msc_data %>% pivot_longer(cols = c(RPELeg, RPEBreathe), names_to = “variable”, values_to = “value”)
plot_rpe_comparison <- ggplot(msc_data_rpe, aes(x = Altitude_code, y = value, fill = variable)) + geom_violin(trim = FALSE, alpha = 0.5, position = position_dodge(width = 0.75)) + # Violin plot geom_boxplot(width = 0.2, color = “white”, alpha = 0.7, position = position_dodge(width = 0.75)) + # Boxplot overlay geom_jitter(aes(color = variable), width = 0.2, alpha = 0.6, size = 2) + # Jitter for individual points labs(title = “Comparison of RPE Breathe vs RPE Leg by Altitude Code”) + scale_y_continuous(name = “RPE Value”) + scale_fill_manual(values = c(“skyblue”, “orange”)) + # Colors for RPE Breathe and RPE Leg scale_color_manual(values = c(“skyblue”, “orange”)) + # Colors for jitter points theme_mls() + # Apply MLS theme with black background theme( axis.text = element_text(color = “white”), # White axis text axis.title = element_text(face = “bold”, color = “white”), # White axis titles plot.background = element_rect(fill = “black”, color = “black”), panel.background = element_rect(fill = “black”, color = “black”), panel.grid.major = element_line(color = “gray30”), panel.grid.minor = element_blank(), legend.title = element_blank(), # Remove legend title legend.text = element_text(color = “white”) # White legend text )
install.packages(“shiny”) install.packages(“shinydashboard”) install.packages(“ggplot2”) install.packages(“ggpubr”) install.packages(“dplyr”)
library(shiny) library(shinydashboard) library(ggplot2) library(ggpubr) library(dplyr) library(tidyr)
theme_mls <- function() { theme_minimal(base_size = 13) + theme( plot.background = element_rect(fill = “black”, color = “black”), panel.background = element_rect(fill = “black”, color = “black”), plot.title = element_text(face = “bold”, size = 16, color = “white”), plot.subtitle = element_text(size = 12, color = “gray90”), plot.caption = element_text(size = 10, face = “italic”, color = “gray80”), axis.title = element_text(face = “bold”, color = “white”), axis.text = element_text(color = “white”), legend.title = element_text(color = “white”), legend.text = element_text(color = “white”), legend.position = “top”, panel.grid.major = element_line(color = “gray30”), panel.grid.minor = element_blank() ) }
This section presents the graphs that explore how altitude impacts perceived effort (RPE), muscle soreness, and performance markers such as high-speed running and session duration.
“) ) ), fluidRow( # Graph 1 box(title =”Graph 1: RPE-Leg vs. Muscle Soreness (DOMS)“, status =”primary”, solidHeader = TRUE, plotOutput(“graph1”)), box(title = “Graph 1 Insights”, status = “primary”, solidHeader = TRUE, HTML(“A clear trend emerges where higher RPE-Leg scores correlate with increased muscle soreness (Soreness_1). At altitude, this relationship becomes more pronounced due to the added fatigue and reduced oxygen availability, which causes a sharper increase in perceived muscular load during sessions.
“)),
# Graph 2
box(title = "Graph 2: RPE-Breathe vs. Muscle Soreness", status = "primary", solidHeader = TRUE,
plotOutput("graph2")),
box(title = "Graph 2 Insights", status = "primary", solidHeader = TRUE,
HTML("<p>RPE-Breathe shows a less pronounced correlation with muscle soreness compared to RPE-Leg. However, athletes training at altitude report heightened respiratory effort, which contributes to greater session stress and delayed recovery. This results in a mild to moderate correlation, likely reflecting whole-body fatigue perceptions.</p>"))
),
fluidRow(
# Graph 3
box(title = "Graph 3: RPE-Leg vs. High-Speed Running (Player Load Proxy)", status = "primary", solidHeader = TRUE,
plotOutput("graph3")),
box(title = "Graph 3 Insights", status = "primary", solidHeader = TRUE,
HTML("<p>Despite moderate PlayerLoad scores, athletes with high RPE-Leg values report that perceived effort often exceeds actual mechanical output. This suggests that altitude may lead to inefficiencies in movement, increasing perceived leg effort during high-speed running.</p>")),
# Graph 4
box(title = "Graph 4: RPE-Breathe vs. High-Speed Running (Player Load Proxy)", status = "primary", solidHeader = TRUE,
plotOutput("graph4")),
box(title = "Graph 4 Insights", status = "primary", solidHeader = TRUE,
HTML("<p>Similar to RPE-Leg, RPE-Breathe shows a connection with high-speed running, although the relationship is more moderate. Increased respiratory strain during high-speed movement at altitude further highlights how hypoxic conditions amplify internal load, even if external load (PlayerLoad) remains stable.</p>"))
),
fluidRow(
# Graph 5
box(title = "Graph 5: RPE-Leg vs. Session Duration", status = "primary", solidHeader = TRUE,
plotOutput("graph5")),
box(title = "Graph 5 Insights", status = "primary", solidHeader = TRUE,
HTML("<p>Longer training sessions typically result in higher RPE-Leg values, but the relationship is notably more pronounced at altitude. Even moderate session durations (~20–30 minutes) lead to increased leg exertion at altitude, suggesting that reduced oxygen availability enhances the perception of effort.</p>")),
# Graph 6
box(title = "Graph 6: RPE-Breathe vs. Session Duration", status = "primary", solidHeader = TRUE,
plotOutput("graph6")),
box(title = "Graph 6 Insights", status = "primary", solidHeader = TRUE,
HTML("<p>Session duration has a direct effect on RPE-Breathe scores, with longer sessions leading to higher perceived breathing effort. This effect is more noticeable at altitude, reinforcing the idea that even moderate training durations lead to significant respiratory strain due to hypoxic conditions.</p>"))
),
fluidRow(
# Graph 7
box(title = "Graph 7: RPE Comparison between Leg and Breathe", status = "primary", solidHeader = TRUE,
plotOutput("graph7")),
box(title = "Graph Insights and Data Interpretation", status = "primary", solidHeader = TRUE,
HTML("<p>The findings from the research and collected data highlight the intensified internal strain athletes experience when training at altitude. Specifically:</p>
<ul>
<li>RPE-Leg correlates strongly with muscle soreness and perceived exertion, even when external load markers, such as PlayerLoad, remain constant or decrease.</li>
<li>RPE-Breathe is a key indicator of hypoxic stress, increasing significantly during moderate-duration sessions and aligning with respiratory fatigue seen in other altitude studies.</li>
<li>There is a critical discrepancy between internal and external loads—training sessions at altitude feel more demanding for athletes, even if external load metrics (e.g., distance, PlayerLoad) remain unchanged or decrease.</li>
</ul>
<p>Coaches must be aware that subjective measures like RPE may spike during early altitude exposure, even when workloads are lower. To manage training load effectively:</p>
<ul>
<li>Monitor both RPE-Leg and RPE-Breathe daily.</li>
<li>Use soreness markers and mood tracking to assess recovery.</li>
<li>Modify training prescriptions (e.g., volume, intensity) until athletes adapt to altitude conditions.</li>
</ul>
<p>These findings stress the importance of integrating contextual monitoring (such as environmental exposure and time spent at altitude) with standard profiling methods to avoid overtraining and enhance altitude acclimatization strategies.</p>"))
)
),
tabItem(tabName = "about",
fluidRow(
box(title = "About the Dashboard", status = "primary", solidHeader = TRUE,
HTML("<p>This interactive dashboard is designed to help analyze the effects of altitude on athletes' internal and external loads, along with soreness and session duration. The data presented is based on performance markers such as RPE-Leg, RPE-Breathe, High-Speed Running, and Session Duration.</p>"))
)
)
)
) )
server <- function(input, output) {
# Assuming your dataset is named ‘msc_data’ and has the following columns: # Altitude_code, Soreness_1, RPELeg, RPEBreathe, HighSpeedRunning, Duration
# Graph 1: RPE-Leg vs Soreness output$graph1 <- renderPlot({ ggboxplot(msc_data, x = “Altitude_code”, y = “Soreness_1”, color = “Altitude_code”, add = “jitter”, add.params = list(alpha = 0.3), ylab = “Soreness”, xlab = “Altitude Code”) + stat_compare_means(method = “t.test”) + labs(title = “RPE Legs vs Soreness”) + theme_mls() })
# Graph 2: RPE-Breathe vs Soreness output$graph2 <- renderPlot({ ggboxplot(msc_data, x = “Altitude_code”, y = “Soreness_1”, color = “Altitude_code”, add = “jitter”, add.params = list(alpha = 0.3), ylab = “Soreness”, xlab = “Altitude Code”) + stat_compare_means(method = “t.test”) + labs(title = “RPE Breathe vs Soreness”) + theme_mls() })
# Graph 3: RPE-Leg vs High-Speed Running output$graph3 <- renderPlot({ ggboxplot(msc_data, x = “Altitude_code”, y = “HighSpeedRunning”, color = “Altitude_code”, add = “jitter”, add.params = list(alpha = 0.3), ylab = “High-Speed Running”, xlab = “Altitude Code”) + stat_compare_means(method = “t.test”) + labs(title = “High-Speed Running vs RPE Legs”) + theme_mls() })
# Graph 4: RPE-Breathe vs High-Speed Running output$graph4 <- renderPlot({ ggboxplot(msc_data, x = “Altitude_code”, y = “HighSpeedRunning”, color = “Altitude_code”, add = “jitter”, add.params = list(alpha = 0.3), ylab = “High-Speed Running”, xlab = “Altitude Code”) + stat_compare_means(method = “t.test”) + labs(title = “High-Speed Running vs RPE Breathe”) + theme_mls() })
# Graph 5: RPE-Leg vs Session Duration output$graph5 <- renderPlot({ ggboxplot(msc_data, x = “Altitude_code”, y = “Duration”, color = “Altitude_code”, add = “jitter”, add.params = list(alpha = 0.3), ylab = “Session Duration”, xlab = “Altitude Code”) + stat_compare_means(method = “t.test”) + labs(title = “Session Duration vs RPE Legs”) + theme_mls() })
# Graph 6: RPE-Breathe vs Session Duration output$graph6 <- renderPlot({ ggboxplot(msc_data, x = “Altitude_code”, y = “Duration”, color = “Altitude_code”, add = “jitter”, add.params = list(alpha = 0.3), ylab = “Session Duration”, xlab = “Altitude Code”) + stat_compare_means(method = “t.test”) + labs(title = “Session Duration vs RPE Breathe”) + theme_mls() })
# Graph 7: RPE Comparison between Leg and Breathe output$graph7 <- renderPlot({ ggplot(msc_data, aes(x = RPELeg, y = RPEBreathe, color = Altitude_code)) + geom_point() + stat_smooth(method = “lm”, color = “white”) + labs(title = “RPE Legs vs RPE Breathe”) + theme_mls() }) }
shinyApp(ui = ui, server = server)