library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.2 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.2 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readxl)
data <-read_xlsx("Lab12data.xlsx")
anova <- aov(Tensile.strength ~ Species, data=data)
summary(anova)
## Df Sum Sq Mean Sq F value Pr(>F)
## Species 2 0.3318 0.16592 3.366 0.0691 .
## Residuals 12 0.5915 0.04929
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
human <- data |> filter(Species=="Human")
mean(human$Tensile.strength) #0.45088
## [1] 0.450588
D <- data |> filter(Species=="D")
mean(D$Tensile.strength) #0.160216
## [1] 0.160216
K <- data |> filter(Species=="K")
mean(K$Tensile.strength) #0.495972
## [1] 0.495972
p <- ggplot(data, aes(x=Species, y=Tensile.strength, fill=Species)) +
geom_boxplot()
p
