getwd()
## [1] "C:/Users/OCN/OneDrive/Documents"
setwd("C:/Users/OCN/Documents")
Tom<-read.csv("C:/Users/OCN/Documents/TomF2.csv")
names(Tom)
## [1] "Treatments" "Reps" "Days.after.Germination"
## [4] "Germination"
head(Tom)
## Treatments Reps Days.after.Germination Germination
## 1 H2O 1 5 13
## 2 H2O 2 5 12
## 3 H2O 3 5 13
## 4 LS 1 5 18
## 5 LS 2 5 22
## 6 LS 3 5 19
str (Tom)
## 'data.frame': 24 obs. of 4 variables:
## $ Treatments : chr "H2O" "H2O" "H2O" "LS" ...
## $ Reps : int 1 2 3 1 2 3 1 2 3 1 ...
## $ Days.after.Germination: int 5 5 5 5 5 5 6 6 6 6 ...
## $ Germination : int 13 12 13 18 22 19 13 12 13 18 ...
###Install Packages###
library(agricolae)
## Warning: package 'agricolae' was built under R version 4.0.5
library (ggplot2)
## Warning: package 'ggplot2' was built under R version 4.0.5
##DO ANOVA###
Tomanov<-aov(Germination~Days.after.Germination+Treatments, data=Tom)
summary(Tomanov)
## Df Sum Sq Mean Sq F value Pr(>F)
## Days.after.Germination 1 10.80 10.80 7.679 0.0114 *
## Treatments 1 253.50 253.50 180.254 8.94e-12 ***
## Residuals 21 29.53 1.41
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
###Days to germination is the block###
###Simple linear regression##
Tomlin <- lm(Germination ~ Treatments, data=Tom)
summary(Tomlin)
##
## Call:
## lm(formula = Germination ~ Treatments, data = Tom)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.1667 -0.7917 -0.1667 1.3333 1.8333
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 13.6667 0.3909 34.97 < 2e-16 ***
## TreatmentsLS 6.5000 0.5528 11.76 5.86e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.354 on 22 degrees of freedom
## Multiple R-squared: 0.8627, Adjusted R-squared: 0.8565
## F-statistic: 138.3 on 1 and 22 DF, p-value: 5.864e-11
###Generate a graph###
(prelim_plot <- ggplot(Tom, aes(x = Days.after.Germination, y =Germination , main= Treatments, colour=Treatments)) +
geom_point() +
geom_smooth(method = "lm"))
## `geom_smooth()` using formula 'y ~ x'

###use the esquisse function for boxplot###