library(ggplot2)

—- Step 1: Load dataset —-

data <- read.csv(“t.csv”)

—- Step 2: Use first 200 rows —-

data_subset <- data[1:200, ]

—- Step 3: Convert numeric columns —-

data_subset\(RR <- as.numeric(as.character(data_subset\)RR)) data_subset\(VO2 <- as.numeric(as.character(data_subset\)VO2)) data_subset\(time <- as.numeric(as.character(data_subset\)time)) data_subset\(power <- as.numeric(as.character(data_subset\)power))

—- Step 4: Mean and SD of RR amplitudes (R–R intervals) —-

mean_amp <- mean(data_subset\(RR, na.rm = TRUE) sd_amp <- sd(data_subset\)RR, na.rm = TRUE)

cat(“Mean of RR (R-peak amplitude surrogate):”, mean_amp, “”) cat(“Standard Deviation of RR:”, sd_amp, “”)

—- Step 5: Fit distribution and plot —-

hist(data_subset\(RR, main = "Distribution of RR Intervals", xlab = "RR Interval (s)", ylab = "Frequency", col = "lightblue", border = "white") lines(density(data_subset\)RR, na.rm = TRUE), col = “red”, lwd = 2)

—- Step 6: Hypothesis test for VO2 —-

Test if mean VO2 ≠ 40 (change 40 as needed)

t_vo2 <- t.test(data_subset$VO2, mu = 40, alternative = “two.sided”) cat(“Hypothesis Test for VO2:”) print(t_vo2)

—- Step 7: Hypothesis test between Time and Power —-

cor_test <- cor.test(data_subset\(time, data_subset\)power, method = “pearson”) cat(“Test between Time and Power:”) print(cor_test)

—- Step 8: Correlation of Time (y) vs RR (x) —-

ggplot(data_subset, aes(x = RR, y = time)) + geom_point(color = “darkgreen”, alpha = 0.6) + geom_smooth(method = “lm”, color = “red”, se = TRUE) + labs(title = “Correlation between Time and RR Interval”, x = “RR Interval (s)”, y = “Time (s)”) + theme_minimal()

—- Step 9: Correlation coefficient —-

r_value <- cor(data_subset\(RR, data_subset\)time, use = “complete.obs”) cat(“coefficient between RR and Time:”, r_value, “”)

—- Step 10: Summary —-

cat(“—– SUMMARY —–”) cat(“Mean RR:”, mean_amp, “”) cat(“SD RR:”, sd_amp, “”) cat(“Correlation (Time vs Power):”, cor_test$estimate, “”) cat(“Correlation (Time vs RR):”, r_value, “”) cat(“——————–”) setwd(“C:/Users/91824/Desktop)