Load and attach data
data <- read.delim("Desktop/rowingdata.txt", header = T, na.strings = "NA")
attach(data)
Load necessary packages
library("ggplot2")
Remove outliers
data <- subset(data, weight1 < 200)
Adjust problem values (a few heights were not converted to cm)
data[data == "5'11\""] = 180
## Warning: invalid factor level, NAs generated
Subset data into lightweights and openweights
light <- subset(data, weight1 < 140)
open <- subset(data, weight1 > 140)
Create necessary new columns
data$newcolumn <- ifelse((data$weight1 > 140), "O", "L")
data$diff <- data$X6k - data$X2k
data$ratio <- data$X2k/data$X6k
light$diff <- light$X6k - light$X2k
open$diff <- open$X6k - open$X2k
This plot shows the ID number of each participant, plotted with the difference in their erg tests. The higher a dot is on this graph, the higher the individuals power to strength ratio is. Lightweights have a significantly lower difference, meaning their peak power and endurance is closer together. Openweights have a higher difference, showing their endurance is lacking and peak power is higher.
qplot(data = data, weight2, diff, color = data$newcolumn, main = "Average Difference from Endurance to\nPower in Rowers of Varying Weights",
xlab = "Weight in kg", ylab = "Difference in Average Watts") + geom_hline(aes(yintercept = mean(light$diff,
na.rm = TRUE)), color = "red") + geom_hline(aes(yintercept = mean(open$diff,
na.rm = TRUE)), color = "turquoise") + scale_color_discrete(name = "Weight Class",
breaks = c("O", "L"), labels = c("Openweight", "Lightweight")) + theme(axis.text.x = element_text(size = 20)) +
theme(axis.text.y = element_text(size = 24)) + theme_bw(18)
## Warning: Removed 80 rows containing missing values (geom_point).
Density Plots of 2k and 6k show that the avg 6k watts are much closer between weight classes than 2k. This means that openweights have a higher peak power to endurance ratio.
Lightweights have a lower peak power to endurance ratio.
ggplot(data, aes(x = X6k, fill = newcolumn)) + geom_density(alpha = 0.3) +
scale_fill_discrete(name = "Weight Class", breaks = c("O", "L"), labels = c("Openweight",
"Lightweight")) + scale_x_continuous(name = "Average Watts Over 6000 Meters") +
scale_y_continuous(name = "Percent") + ggtitle("Density Plot of 6000 Meter Watts") +
theme(axis.text.x = element_text(size = 20)) + theme(axis.text.y = element_text(size = 20)) +
opts(plot.title = theme_text(size = 48)) + theme_bw(20)
## Warning: 'opts' is deprecated. Use 'theme' instead. See help("Deprecated")
## Warning: 'theme_text' is deprecated. Use 'element_text' instead. See
## help("Deprecated")
## Warning: Removed 16 rows containing non-finite values (stat_density).
## Warning: Removed 55 rows containing non-finite values (stat_density).
ggplot(data, aes(x = X2k, fill = newcolumn)) + geom_density(alpha = 0.3) +
scale_fill_discrete(name = "Weight Class", breaks = c("O", "L"), labels = c("Openweight",
"Lightweight")) + scale_x_continuous(name = "Average Watts Over 2000 Meters") +
scale_y_continuous(name = "Percent") + ggtitle("Density Plot of 2000 Meter Watts") +
theme(axis.text.x = element_text(size = 20)) + theme(axis.text.y = element_text(size = 20)) +
opts(plot.title = theme_text(size = 48)) + theme_bw(20)
## Warning: 'opts' is deprecated. Use 'theme' instead. See help("Deprecated")
## Warning: 'theme_text' is deprecated. Use 'element_text' instead. See
## help("Deprecated")
## Warning: Removed 4 rows containing non-finite values (stat_density).
## Warning: Removed 9 rows containing non-finite values (stat_density).
These density plots will show the variation between openweights and lightweights.
First shows the difference in ratios of 2000M average watts to 6000M average watts.
ggplot(data, aes(x = ratio, fill = newcolumn)) + geom_density(alpha = 0.3) +
scale_fill_discrete(name = "Weight Class", breaks = c("O", "L"), labels = c("Openweight",
"Lightweight")) + scale_x_continuous(name = "Ratio of Average Watts of\n2000 Meters to 6000 Meters") +
scale_y_continuous(name = "Percent of Sample") + ggtitle("Ratio of Average Watts for 2000 Meters and\n6000 Meters in Different Weight Classes") +
theme(axis.text.x = element_text(size = 20)) + theme(axis.text.y = element_text(size = 20)) +
opts(plot.title = theme_text(size = 48)) + theme_bw(18)
## Warning: 'opts' is deprecated. Use 'theme' instead. See help("Deprecated")
## Warning: 'theme_text' is deprecated. Use 'element_text' instead. See
## help("Deprecated")
## Warning: Removed 18 rows containing non-finite values (stat_density).
## Warning: Removed 62 rows containing non-finite values (stat_density).
Second shows the difference in 2000M average watts to 6000M average watts
ggplot(data, aes(x = diff, fill = newcolumn)) + geom_density(alpha = 0.3) +
scale_fill_discrete(name = "Weight Class", breaks = c("O", "L"), labels = c("Openweight",
"Lightweight")) + scale_x_continuous(name = "Difference in Average Watts Over 2000 Meters and 6000 Meters") +
scale_y_continuous(name = "Percent") + ggtitle("Difference of Average watts for 2000 Meters and 6000 Meters in Different Weight Classes")
## Warning: Removed 18 rows containing non-finite values (stat_density).
## Warning: Removed 62 rows containing non-finite values (stat_density).
This is data from the olympic level. Erg standards for women for 6000 meters and 2000 meters. Separated by openweight standards and lightweight standards.
Enter necessary data for elite bar graph
mean(light$X2k, na.rm = T)
## [1] 185.9
mean(open$X2k, na.rm = T)
## [1] 233.3
mean(light$X6k, na.rm = T)
## [1] 145.3
mean(open$X6k, na.rm = T)
## [1] 177.2
erg <- c(338, 273, 186, 233, 282, 230, 145, 177)
WC <- c("Openweight", "Lightweight", "Lightweight", "Openweight",
"Openweight", "Lightweight", "Lightweight", "Openweight")
status <- c("Elite", "Elite", "Collegiate", "Collegiate", "Elite",
"Elite", "Collegiate", "Collegiate")
type <- c("Elite 2k", "Elite 2k", "Collegiate 2k", "Collegiate 2k",
"Elite 6k", "Elite 6k", "Collegiate 6k", "Collegiate 6k")
elite2 <- data.frame(erg, WC, status, type)
This graph is to display the ratio of average watts for 2000 meters and 6000 meters at the olympic level. Important to note, ratio of 2k:6k is 1.18 for lightweights and 1.2 for openweights. While the difference between watts is much less for lightweights, the ratio is the same
ggplot(data = elite2, aes(x = type, y = erg, fill = WC)) + geom_bar(stat = "identity",
position = position_dodge(), colour = "black") + scale_fill_manual(values = c("#000666",
"#999999")) + ylab("Average Watts") + xlab("") + ggtitle("Olympic Ergometer Time Standards\nCompared to Collegiate Results") +
geom_text(aes(label = erg), position = position_dodge(width = 0.9), vjust = -0.25) +
theme_bw(18) + theme(axis.title.x = element_text(face = "bold", colour = "#990000",
size = 20), axis.text.x = element_text(angle = -50, vjust = 0.5, size = 18)) +
scale_y_continuous(limits = c(0, 350))
## ymax not defined: adjusting position using y instead