| title: “Engaged_Learning_Part2” |
| output: html_document |
| date: “2026-04-02” |
library(meta)
## Loading required package: metadat
## Loading 'meta' package (version 8.2-1).
## Type 'help(meta)' for a brief overview.
library(metafor)
## Loading required package: Matrix
## Loading required package: numDeriv
##
## Loading the 'metafor' package (version 4.8-0). For an
## introduction to the package please type: help(metafor)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
#fix variable names to be compatible with R
library(readxl)
pre <- read_excel("Data Engaged Learning_raw.xlsx", sheet = 1)
## New names:
## • `` -> `...48`
post <- read_excel("Data Engaged Learning_raw.xlsx", sheet = 2)
## New names:
## • `` -> `...46`
#"C:\Users\ADMIN\OneDrive - St. Mary's College of MD\Data Engaged Learning_raw.xlsx"
excel_sheets("Data Engaged Learning_raw.xlsx")
## [1] "PRE" "POST"
names(pre) <- make.names(names(pre))
names(post) <- make.names(names(post))
#Merge Pre and Post datasets
data <- pre %>%
inner_join(post, by = "Atleta", suffix = c("_pre", "_post"))
## Warning in inner_join(., post, by = "Atleta", suffix = c("_pre", "_post")): Detected an unexpected many-to-many relationship between `x` and `y`.
## ℹ Row 13 of `x` matches multiple rows in `y`.
## ℹ Row 13 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected, set `relationship =
## "many-to-many"` to silence this warning.
#compute differences in variable
data <- data %>%
mutate(
RE15_change = RE15_post - RE15_pre,
RE17_change = RE17.1_post - RE17.1_pre,
RE20_change = RE20_post - RE20_pre,
RPE15_change = RPE15_post - RPE15_pre,
RPE17_change = RPE17.1_post - RPE17.1_pre,
RPE20_change = RPE20_post - RPE20_pre
)
#compute effect sizes
library(metafor)
vars <- c("RE15_change", "RE17_change", "RE20_change",
"RPE15_change", "RPE17_change", "RPE20_change")
results <- lapply(vars, function(v) {
placebo <- data %>% filter(Grupo_pre == "Placebo")
nitrato <- data %>% filter(Grupo_pre == "Nitrato")
escalc(
measure = "SMD",
m1i = mean(nitrato[[v]], na.rm = TRUE),
sd1i = sd(nitrato[[v]], na.rm = TRUE),
n1i = sum(!is.na(nitrato[[v]])),
m2i = mean(placebo[[v]], na.rm = TRUE),
sd2i = sd(placebo[[v]], na.rm = TRUE),
n2i = sum(!is.na(placebo[[v]]))
) %>%
mutate(variable = v)
})
es_data <- do.call(rbind, results)
#make forest plot
forest(
es_data$yi,
vi = es_data$vi,
slab = es_data$variable,
xlab = "Effect size (SMD)",
main = "Standardized Mean Differences of Running Economy \nand Rate of Perceived Exertion" ,
psize = 1
)
mtext("Fig 2. Forest plot with standardized mean differences (SMD) and 95% CI for RPE and RE.\nLower scores indicate lower values in the experimental group",
side = 1, line = 4, cex = 0.8
)
#Publication figure
#Note that the original forest plot includes Rate of Perceived Exertion (RPE) and oxygen Saturation (SMO2). The forest plot was changed to include running economy because oxygen saturation was not included in the original dataset. There is however a table used later in the publication only that has SMO2 data that was used to make the grouped bar lot below.
library(ggplot2)
#Make dataset
data_smo2 <- data.frame(
speed = rep(c(15, 17.1, 20), times = 4),
group = rep(c("Experimental", "Experimental", "Placebo", "Placebo"), each = 3),
time = rep(c("Pre", "Post", "Pre", "Post"), each = 3),
mean = c(
41.7, 34.4, 24.4, # Experimental Pre Group
47.7, 41.0, 31.0, # Experimental Post Group
46.6, 38.2, 26.8, # Placebo Pre Group
43.7, 37.8, 27.7 # Placebo Post Group
),
sd = c(
7.1, 3.5, 2.8,
3.9, 2.0, 6.9,
15.5, 16.4, 12.1,
5.9, 5.2, 4.8
)
)
#Make grouped barplot by speed and by experimental vs placebo
ggplot(data_smo2, aes(x = factor(speed), y = mean, fill = time)) +
geom_bar(stat = "identity", position = position_dodge(width = 0.8)) +
geom_errorbar(
aes(ymin = mean - sd, ymax = mean + sd),
position = position_dodge(width = 0.8),
width = 0.2
) +
facet_wrap(~ group) +
labs(
title = "SmO2 (%) by Speed",
x = "Speed (km/h)",
y = "SmO2 (%)",
caption = "Grouped Barplot displaying oxygen saturation percentage (SMO2 %) divided by experimental and placebo group \n and running speed in km/hr." ,
fill = "Time"
) +
scale_fill_brewer(palette = "Set1") +
theme_minimal()+
theme(
plot.caption = ggplot2::element_text(hjust = 0, lineheight = 1.2),
plot.margin = ggplot2::margin(t = 10, r = 10, b = 30, l = 10)
)
#Table From Publication