library(readxl)
Plant_Growth_500_Rows <- read_excel("C:/Users/jacob/Downloads/Plant_Growth_500_Rows.xlsx")
View(Plant_Growth_500_Rows)
# Since I have already instealled "readxl" package, it is time to load library
library(readxl)
# Lets take a closer look into the structure of the dataset
str(Plant_Growth_500_Rows)
## tibble [500 × 2] (S3: tbl_df/tbl/data.frame)
## $ weight: num [1:500] 5.5 4.86 5.65 6.52 4.77 ...
## $ group : chr [1:500] "treatment1" "treatment1" "treatment2" "treatment2" ...
# ANOVA would be usefull to analyze the weight differences across all of the groups
anova_results <- anova(lm(weight ~ group, data = Plant_Growth_500_Rows))
print(anova_results)
## Analysis of Variance Table
##
## Response: weight
## Df Sum Sq Mean Sq F value Pr(>F)
## group 2 2.34 1.17065 1.2169 0.297
## Residuals 497 478.12 0.96202
# To different the differences I will add colors to help specifically assign the colors to each group
colors <- c("lightblue", "lightgreen", "salmon")
# Boxplot
boxplot(weight ~ group, data = Plant_Growth_500_Rows,
ylab = "Weight", main = "Plant Growth by Group",
col = colors, border = "darkgray")
# Adding a legend to represent the colors for each group
legend("topright", legend = levels(as.factor(Plant_Growth_500_Rows$group)),
fill = colors, border = "darkgray", title = "Group")
