library(readxl)
## Warning: package 'readxl' was built under R version 4.4.3
arabidopsis <- read_excel("arabidopsisdata.xlsx")
## New names:
## • `` -> `...7`
arabidopsis
## # A tibble: 499 × 7
##    SaltConc Session Variety RootLength LateralRootNumber LeafNumber ...7 
##       <dbl>   <dbl> <chr>        <dbl>             <dbl>      <dbl> <chr>
##  1        0       2 Cvi-0            0                 0          0 <NA> 
##  2        0       2 Cvi-0            0                 0          0 <NA> 
##  3        0       2 Cvi-0            0                 0          0 <NA> 
##  4        0       2 Cvi-0            0                 0          0 <NA> 
##  5        0       2 Cvi-0            0                 0          0 <NA> 
##  6        0       2 Cvi-0            0                 0          0 <NA> 
##  7        0       2 Cvi-0            0                 0          0 <NA> 
##  8        0       2 Cvi-0            0                 0          0 <NA> 
##  9        0       2 Cvi-0            0                 0          0 <NA> 
## 10        0       2 Cvi-0            0                 0          0 <NA> 
## # ℹ 489 more rows
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.4.3
#create two separate boxplots of all the groups
#one for 0mM, second for 160mM
#conduct paired t tests - assuming normal distributions is biologically accurate
#make graphs of average root length over 3 weeks
unique(arabidopsis$SaltConc)
## [1]   0  80 160
head(arabidopsis$SaltConc, 10)
##  [1] 0 0 0 0 0 0 0 0 0 0
str(arabidopsis$SaltConc)
##  num [1:499] 0 0 0 0 0 0 0 0 0 0 ...
arabidopsis$SaltConc <- factor(arabidopsis$SaltConc,
                               levels = c(0, 80, 160),
                               labels = c("0 mM", "80 mM", "160 mM"))

unique(arabidopsis$SaltConc)
## [1] 0 mM   80 mM  160 mM
## Levels: 0 mM 80 mM 160 mM
arabidopsissession4 <- subset(arabidopsis, Session == 4)

arabidopsissession4
## # A tibble: 148 × 7
##    SaltConc Session Variety RootLength LateralRootNumber LeafNumber ...7 
##    <fct>      <dbl> <chr>        <dbl>             <dbl>      <dbl> <chr>
##  1 0 mM           4 Cvi-0            0                 0          0 <NA> 
##  2 0 mM           4 Cvi-0            0                 0          0 <NA> 
##  3 0 mM           4 Cvi-0            0                 0          0 <NA> 
##  4 0 mM           4 Cvi-0            0                 0          0 <NA> 
##  5 0 mM           4 Cvi-0            0                 0          0 <NA> 
##  6 0 mM           4 Cvi-0            0                 0          0 <NA> 
##  7 0 mM           4 Cvi-0            0                 0          0 <NA> 
##  8 0 mM           4 Cvi-0            0                 0          0 <NA> 
##  9 0 mM           4 Cvi-0            0                 0          0 <NA> 
## 10 0 mM           4 Cvi-0            0                 0          0 <NA> 
## # ℹ 138 more rows
names(arabidopsissession4) <- make.names(names(arabidopsissession4))

library(ggplot2)
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.4.3
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
#this is a boxplot of root length at 0mM and 160mM. REMEMBER TO LIBRARY BOTH DPLYR AND GGPLOT OR ELSE IT WILL NOT WORK
rootlength0 <- ggplot(filter(arabidopsissession4, SaltConc == "0 mM"),
             aes(x = Variety, y = RootLength, fill = Variety)) +
  geom_boxplot(fill = "#F8766D", alpha = 0.8) +
  labs(title = "0 mM", x = "A. thaliana varieties", y = "Root length (mm)") +
  theme_minimal(base_size = 13) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1),
        legend.position = "none")

rootlength80 <- ggplot(filter(arabidopsissession4, SaltConc == "80 mM"),
             aes(x = Variety, y = RootLength, fill = Variety)) +
  geom_boxplot(fill = "#7CAE00", alpha = 0.8) +
  labs(title = "80 mM", x = "A. thaliana varieties", y = "Root length (mm)") +
  theme_minimal(base_size = 13) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1),
        legend.position = "none")

rootlength160 <- ggplot(filter(arabidopsissession4, SaltConc == "160 mM"),
               aes(x = Variety, y = RootLength, fill = Variety)) +
  geom_boxplot(fill = "#00BFC4", alpha = 0.8) +
  labs(title = "160 mM", x = "A. thaliana varieties", y = "Root length (mm)") +
  theme_minimal(base_size = 13) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1),
        legend.position = "none")

rootlength0; rootlength80; rootlength160

#this function adds the figures into one figure - need patchwork package
library(patchwork)
## Warning: package 'patchwork' was built under R version 4.4.3
(rootlength0 + rootlength80 + rootlength160) +
  plot_annotation(
    title = "Root Length Across Three Salt Concentrations"
  ) &
  theme_gray(base_size = 13)

#its better to create 2 separate boxplots because it is easier to see the differences and spread of the root lengths at 160 mM, otherwise it's difficult to see them when added to the root lengths at 0 mM
#boxplot of lateral root lengths

library(readxl)
library(ggplot2)
library(dplyr)

lr0 <- ggplot(filter(arabidopsissession4, SaltConc == "0 mM"),
             aes(x = Variety, y = LateralRootNumber, fill = Variety)) +
  geom_boxplot(fill = "#F8766D", alpha = 0.8) +
  labs(title = "Number of lateral roots of 6 varieties at a salt concentration of 0 mM", x = "A. thaliana varieties", y = "Number of lateral roots") +
  theme_minimal(base_size = 13) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1),
        legend.position = "none")

lr0

lr80 <- ggplot(filter(arabidopsissession4, SaltConc == "80 mM"),
             aes(x = Variety, y = LateralRootNumber, fill = Variety)) +
  geom_boxplot(fill = "#7CAE00", alpha = 0.8) +
  labs(title = "Number of lateral roots of 6 varieties at a salt concentration of 80 mM", x = "A. thaliana varieties", y = "Number of lateral roots") +
  theme_minimal(base_size = 13) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1),
        legend.position = "none")

lr80

#this doesn't work because you dont have all your data for lateral root lengths yet. ask gio.

lr160 <- ggplot(filter(arabidopsissession4, SaltConc == "160 mM"),
             aes(x = Variety, y = LateralRootNumber, fill = Variety)) +
  geom_boxplot(fill = "#00BFC4", alpha = 0.8) +
  labs(title = "Number of lateral roots of 6 varieties at a salt concentration of 0 mM", x = "A. thaliana varieties", y = "Number of lateral roots") +
  theme_minimal(base_size = 13) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1),
        legend.position = "none")

lr160

#clearly there's no growth, so this is pointless to look at. we have added too much salt for lateral root growth to occur. use data for 80 mM.

arabidopsissession4 %>%
  filter(SaltConc %in% c("0 mM", "80 mM")) %>%
  ggplot(aes(x = Variety, y = LateralRootNumber, fill = SaltConc)) +
  geom_boxplot(alpha = 0.8) +
  scale_fill_manual(values = c("0 mM" = "#F8766D",
                               "80 mM" = "#7CAE00")) +
  facet_wrap(~ SaltConc, ncol = 2) +
  labs(title = "Lateral root numbers at 0 mM and 80 mM NaCl",
       x = "A. thaliana varieties",
       y = "Lateral root number") +
  theme_minimal(base_size = 13) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1),
        legend.position = "none")

#this is a boxplot for just 0mm and 80mm because 160mm has pretty much no data
#creating the scatter plot for the germination rate data over sessions 1-4
germination <- read_excel("germinationdata.xlsx")
class(germination$Session)
## [1] "numeric"
class(germination$SaltConc)
## [1] "numeric"
SaltConc <- as.factor(germination$SaltConc)
Variety <- as.factor(germination$Variety)

germination <- germination %>%
  mutate(
    SaltConc = factor(SaltConc, levels = c(0, 80, 160),
                      labels = c("0 mM", "80 mM", "160 mM")),
    Variety  = as.factor(Variety)
  )

#reading in the file and converting some variables to factors for data visualization

ggplot(germination, aes(x = Session,
                        y = GerminationRate,
                        color = SaltConc,
                        linetype = SaltConc,
                        group = SaltConc)) +
  geom_point(size = 2) +
  geom_line(linewidth = 0.9) +
  facet_wrap(~ Variety, ncol = 3) +
  scale_color_manual(values = c("0 mM" = "#F8766D",
                                "80 mM" = "#7CAE00",
                                "160 mM" = "#00BFC4")) +
  scale_linetype_manual(values = c("0 mM" = "solid",
                                   "80 mM" = "dashed",
                                   "160 mM" = "dotdash")) +
  labs(title = "Germination rate under 0, 80, and 160 mM NaCl",
       x = "Week", y = "Germination rate (%)",
       color = "Salt concentration",
       linetype = "Salt concentration") +
  theme_gray(base_size = 13)

#conduct an ANOVA between salt concentrations within the same varieties. because we have 3 different concentrations - 0mM, 80mM and 160mM

library(FSA)
## Warning: package 'FSA' was built under R version 4.4.3
## ## FSA v0.10.0. See citation('FSA') if used in publication.
## ## Run fishR() for related website and fishR('IFAR') for related book.
library(dunn.test)

pa1 <- read_excel("arabidopsisdata.xlsx", sheet = "Pa-1")
pa1
## # A tibble: 24 × 6
##    SaltConc Session Variety RootLength LateralRootNumber LeafNumber
##       <dbl>   <dbl> <chr>        <dbl>             <dbl>      <dbl>
##  1        0       4 Pa-1            50                 0          4
##  2        0       4 Pa-1            45                 1          4
##  3        0       4 Pa-1            53                 3          6
##  4        0       4 Pa-1            58                 5          6
##  5        0       4 Pa-1            40                 2          6
##  6        0       4 Pa-1            50                 2          4
##  7        0       4 Pa-1            57                 7          6
##  8        0       4 Pa-1            57                 6          6
##  9        0       4 Pa-1            60                 1          1
## 10        0       4 Pa-1            11                 9          6
## # ℹ 14 more rows
pa1kruskalwallis <- kruskal.test(RootLength~SaltConc, data = pa1)
pa1kruskalwallis
## 
##  Kruskal-Wallis rank sum test
## 
## data:  RootLength by SaltConc
## Kruskal-Wallis chi-squared = 16.439, df = 2, p-value = 0.0002694
#did KW test because my data violated literally every single ANOVA assumption

tupk7 <- read_excel("arabidopsisdata.xlsx", sheet = "Tu-PK7")
## New names:
## • `` -> `...7`
## • `` -> `...8`
tupk7
## # A tibble: 28 × 8
##    SaltConc Session Variety RootLength LateralRootNumber LeafNumber  ...7  ...8
##       <dbl>   <dbl> <chr>        <dbl>             <dbl>      <dbl> <dbl> <dbl>
##  1        0       4 Tu-PK7          97                14          8  NA    NA  
##  2        0       4 Tu-PK7          96                19          7  NA    NA  
##  3        0       4 Tu-PK7          73                16          6  NA    NA  
##  4        0       4 Tu-PK7          76                18          8  NA    NA  
##  5        0       4 Tu-PK7          72                17          7  NA    NA  
##  6        0       4 Tu-PK7          72                22          4  NA    NA  
##  7        0       4 Tu-PK7          72                18          7  NA    NA  
##  8        0       4 Tu-PK7          71                20          8  NA    NA  
##  9        0       4 Tu-PK7          54                17          6  NA    NA  
## 10        0       4 Tu-PK7          83                16          6  72.5  17.5
## # ℹ 18 more rows
tupk7kruskalwallis <- kruskal.test(RootLength~SaltConc, data = tupk7)
tupk7kruskalwallis
## 
##  Kruskal-Wallis rank sum test
## 
## data:  RootLength by SaltConc
## Kruskal-Wallis chi-squared = 17.052, df = 2, p-value = 0.0001982
dunnTest(RootLength ~ as.factor(SaltConc),
         data = tupk7,
         method = "bh")
## Dunn (1964) Kruskal-Wallis multiple comparison
##   p-values adjusted with the Benjamini-Hochberg method.
##   Comparison          Z      P.unadj        P.adj
## 1    0 - 160  3.2876399 1.010310e-03 0.0015154646
## 2     0 - 80 -0.6538254 5.132243e-01 0.5132243116
## 3   160 - 80 -3.9040724 9.458747e-05 0.0002837624
kew1 <- read_excel("arabidopsisdata.xlsx", sheet = "Kew-1")
kew1
## # A tibble: 10 × 6
##    SaltConc Session Variety RootLength LateralRootNumber LeafNumber
##       <dbl>   <dbl> <chr>        <dbl>             <dbl>      <dbl>
##  1        0       4 Kew-1            1            0          2     
##  2        0       4 Kew-1           54            4          0     
##  3        0       4 Kew-1           28            0          2     
##  4        0       4 Kew-1            3            0          0     
##  5        0       4 Kew-1           18            0          2     
##  6        0       4 Kew-1            6            0          4     
##  7        0       4 Kew-1           15            0          0     
##  8       80       4 Kew-1            3            0          0     
##  9       80       4 Kew-1           29            0          0     
## 10      160       4 Kew-1            0            0.0001     0.0001
kew1kruskalwallis <- kruskal.test(RootLength~SaltConc, data = kew1)
kew1kruskalwallis
## 
##  Kruskal-Wallis rank sum test
## 
## data:  RootLength by SaltConc
## Kruskal-Wallis chi-squared = 2.4872, df = 2, p-value = 0.2884
oy0 <- read_excel("arabidopsisdata.xlsx", sheet = "Oy-0")
## New names:
## • `` -> `...7`
oy0
## # A tibble: 36 × 7
##    SaltConc Session Variety RootLength LateralRootNumber LeafNumber  ...7
##       <dbl>   <dbl> <chr>        <dbl>             <dbl>      <dbl> <dbl>
##  1        0       4 Oy-0            75                 6          6    NA
##  2        0       4 Oy-0            87                 6          5    NA
##  3        0       4 Oy-0            88                 3          6    NA
##  4        0       4 Oy-0            92                 3          6    NA
##  5        0       4 Oy-0            89                 3          6    NA
##  6        0       4 Oy-0            85                 3          6    NA
##  7        0       4 Oy-0            85                 3          6    NA
##  8        0       4 Oy-0            96                 1          6    NA
##  9        0       4 Oy-0            89                 1          6    NA
## 10        0       4 Oy-0            95                 2          6    NA
## # ℹ 26 more rows
oy0kruskalwallis <- kruskal.test(RootLength~SaltConc, data = oy0)
oy0kruskalwallis
## 
##  Kruskal-Wallis rank sum test
## 
## data:  RootLength by SaltConc
## Kruskal-Wallis chi-squared = 31.097, df = 2, p-value = 1.768e-07
oy0kruskalwallis1 <- kruskal.test(LateralRootNumber~SaltConc, data = oy0)
oy0kruskalwallis1
## 
##  Kruskal-Wallis rank sum test
## 
## data:  LateralRootNumber by SaltConc
## Kruskal-Wallis chi-squared = 31.271, df = 2, p-value = 1.62e-07
dunnTest(LateralRootNumber ~ as.factor(SaltConc),
         data = oy0,
         method = "bh")
## Dunn (1964) Kruskal-Wallis multiple comparison
##   p-values adjusted with the Benjamini-Hochberg method.
##   Comparison         Z      P.unadj        P.adj
## 1    0 - 160  2.394274 1.665329e-02 1.665329e-02
## 2     0 - 80 -3.021143 2.518226e-03 3.777338e-03
## 3   160 - 80 -5.555005 2.776046e-08 8.328138e-08
col0 <- read_excel("arabidopsisdata.xlsx", sheet = "Col-0")
## New names:
## • `` -> `...7`
col0
## # A tibble: 25 × 7
##    SaltConc Session Variety RootLength LateralRootNumber LeafNumber  ...7
##       <dbl>   <dbl> <chr>        <dbl>             <dbl>      <dbl> <dbl>
##  1        0       4 Col-0           58                 4          6 NA   
##  2        0       4 Col-0           75                11          6 NA   
##  3        0       4 Col-0           70                 8          6 NA   
##  4        0       4 Col-0           91                 9          7 NA   
##  5        0       4 Col-0           68                17          6 NA   
##  6        0       4 Col-0           87                10          6 NA   
##  7        0       4 Col-0           36                 0          0 NA   
##  8        0       4 Col-0           58                 9          5 NA   
##  9        0       4 Col-0           82                 8          5 NA   
## 10        0       4 Col-0           94                 5          7  7.64
## # ℹ 15 more rows
col0kruskalwallis <- kruskal.test(RootLength~SaltConc, data = col0)
col0kruskalwallis
## 
##  Kruskal-Wallis rank sum test
## 
## data:  RootLength by SaltConc
## Kruskal-Wallis chi-squared = 17.818, df = 2, p-value = 0.0001351
#conduct KW tests among varieties within the same salt concentrations
#ROOT LENGTH
zerosalt <- read_excel("arabidopsisdata.xlsx", sheet = "0mM")
## New names:
## • `` -> `...7`
zerosalt
## # A tibble: 50 × 7
##    SaltConc Session Variety RootLength LateralRootNumber LeafNumber  ...7
##       <dbl>   <dbl> <chr>        <dbl>             <dbl>      <dbl> <dbl>
##  1        0       4 Pa-1            50                 0          4    NA
##  2        0       4 Pa-1            45                 1          4    NA
##  3        0       4 Pa-1            53                 3          6    NA
##  4        0       4 Pa-1            58                 5          6    NA
##  5        0       4 Pa-1            40                 2          6    NA
##  6        0       4 Pa-1            50                 2          4    NA
##  7        0       4 Pa-1            57                 7          6    NA
##  8        0       4 Pa-1            57                 6          6    NA
##  9        0       4 Pa-1            60                 1          1    NA
## 10        0       4 Pa-1            11                 9          6    NA
## # ℹ 40 more rows
zerosaltkruskalwallisrootlength <- kruskal.test(RootLength~Variety, data = zerosalt)
zerosaltkruskalwallisrootlength
## 
##  Kruskal-Wallis rank sum test
## 
## data:  RootLength by Variety
## Kruskal-Wallis chi-squared = 35.433, df = 4, p-value = 3.785e-07
dunnTest(RootLength ~ Variety,
         data = zerosalt,
         method = "bh")
## Warning: Variety was coerced to a factor.
## Dunn (1964) Kruskal-Wallis multiple comparison
##   p-values adjusted with the Benjamini-Hochberg method.
##        Comparison          Z      P.unadj        P.adj
## 1   Col-0 - Kew-1  3.2537589 1.138889e-03 2.847222e-03
## 2    Col-0 - Oy-0 -1.8612870 6.270365e-02 8.957665e-02
## 3    Kew-1 - Oy-0 -4.9984609 5.778973e-07 5.778973e-06
## 4    Col-0 - Pa-1  2.4149312 1.573818e-02 2.623030e-02
## 5    Kew-1 - Pa-1 -1.1973597 2.311664e-01 2.568515e-01
## 6     Oy-0 - Pa-1  4.4254010 9.626330e-06 4.813165e-05
## 7  Col-0 - Tu-PK7 -0.4833969 6.288139e-01 6.288139e-01
## 8  Kew-1 - Tu-PK7 -3.6924345 2.221176e-04 7.403920e-04
## 9   Oy-0 - Tu-PK7  1.3665145 1.717775e-01 2.147219e-01
## 10  Pa-1 - Tu-PK7 -2.9198228 3.502304e-03 7.004609e-03
eightysalt <- read_excel("arabidopsisdata.xlsx", sheet = "80mM")
## New names:
## • `` -> `...7`
eightysalt
## # A tibble: 45 × 7
##    SaltConc Session Variety RootLength LateralRootNumber LeafNumber  ...7
##       <dbl>   <dbl> <chr>        <dbl>             <dbl>      <dbl> <dbl>
##  1       80       4 Pa-1            19                 4         NA    NA
##  2       80       4 Pa-1             0                 0         NA    NA
##  3       80       4 Pa-1             0                 0         NA    NA
##  4       80       4 Pa-1             0                 0         NA    NA
##  5       80       4 Pa-1            24                 2         NA    NA
##  6       80       4 Pa-1             0                 0         NA    NA
##  7       80       4 Pa-1             0                 0         NA    NA
##  8       80       4 Pa-1            26                 7         NA    NA
##  9       80       4 Pa-1             0                 0         NA    NA
## 10       80       4 Pa-1             0                 0         NA    NA
## # ℹ 35 more rows
eightysaltkruskalwallisrootlength <- kruskal.test(RootLength~Variety, data = eightysalt)
eightysaltkruskalwallisrootlength
## 
##  Kruskal-Wallis rank sum test
## 
## data:  RootLength by Variety
## Kruskal-Wallis chi-squared = 32.308, df = 4, p-value = 1.655e-06
dunnTest(RootLength ~ Variety,
         data = eightysalt,
         method = "bh")
## Warning: Variety was coerced to a factor.
## Dunn (1964) Kruskal-Wallis multiple comparison
##   p-values adjusted with the Benjamini-Hochberg method.
##        Comparison          Z      P.unadj        P.adj
## 1   Col-0 - Kew-1  0.9872659 3.235123e-01 3.594581e-01
## 2    Col-0 - Oy-0 -1.4221555 1.549811e-01 1.937264e-01
## 3    Kew-1 - Oy-0 -1.8247646 6.803655e-02 1.133943e-01
## 4    Col-0 - Pa-1  2.4106850 1.592259e-02 3.184519e-02
## 5    Kew-1 - Pa-1  0.4335832 6.645912e-01 6.645912e-01
## 6     Oy-0 - Pa-1  4.1427090 3.432273e-05 1.716137e-04
## 7  Col-0 - Tu-PK7 -2.6811026 7.338001e-03 2.446000e-02
## 8  Kew-1 - Tu-PK7 -2.5867177 9.689495e-03 2.422374e-02
## 9   Oy-0 - Tu-PK7 -1.5077565 1.316169e-01 1.880241e-01
## 10  Pa-1 - Tu-PK7 -5.2313145 1.683089e-07 1.683089e-06
onehundredsixtysalt <- read_excel("arabidopsisdata.xlsx", sheet = "160mM")
## New names:
## • `` -> `...7`
onehundredsixtysalt
## # A tibble: 28 × 7
##    SaltConc Session Variety RootLength LateralRootNumber LeafNumber  ...7
##       <dbl>   <dbl> <chr>        <dbl>             <dbl>      <dbl> <dbl>
##  1      160       4 Pa-1             4            0.0001     0.0001    NA
##  2      160       4 Pa-1             3            0.0001     0.0001    NA
##  3      160       4 Tu-PK7          12            0.0001     0.0001    NA
##  4      160       4 Tu-PK7          12            0.0001     0.0001    NA
##  5      160       4 Tu-PK7           2            0.0001     0.0001    NA
##  6      160       4 Tu-PK7           6            0.0001     0.0001    NA
##  7      160       4 Tu-PK7           3            0.0001     0.0001    NA
##  8      160       4 Tu-PK7           2            0.0001     0.0001    NA
##  9      160       4 Tu-PK7           2            0.0001     0.0001    NA
## 10      160       4 Tu-PK7           2            0.0001     0.0001     3
## # ℹ 18 more rows
onehundredsixtysaltkruskalwallisrootlength <- kruskal.test(RootLength~Variety, data = onehundredsixtysalt)
onehundredsixtysaltkruskalwallisrootlength
## 
##  Kruskal-Wallis rank sum test
## 
## data:  RootLength by Variety
## Kruskal-Wallis chi-squared = 7.7675, df = 4, p-value = 0.1005
dunnTest(RootLength ~ Variety,
         data = onehundredsixtysalt,
         method = "bh")
## Warning: Variety was coerced to a factor.
## Dunn (1964) Kruskal-Wallis multiple comparison
##   p-values adjusted with the Benjamini-Hochberg method.
##        Comparison          Z    P.unadj     P.adj
## 1   Col-0 - Kew-1  2.1462575 0.03185244 0.3185244
## 2    Col-0 - Oy-0  2.1093250 0.03491654 0.1745827
## 3    Kew-1 - Oy-0 -1.1945819 0.23225042 0.3870840
## 4    Col-0 - Pa-1  0.4271411 0.66927658 0.7436406
## 5    Kew-1 - Pa-1 -1.6080605 0.10782193 0.2695548
## 6     Oy-0 - Pa-1 -0.9389333 0.34776501 0.4968072
## 7  Col-0 - Tu-PK7  0.8309625 0.40599479 0.5074935
## 8  Kew-1 - Tu-PK7 -1.7625363 0.07797873 0.2599291
## 9   Oy-0 - Tu-PK7 -1.3380787 0.18087078 0.3617416
## 10  Pa-1 - Tu-PK7  0.1265061 0.89933134 0.8993313
#IMPORTANT: you chose to remove Cvi-0 as a variable because they had not germinated at all. If you had kept it it would render truly significant biological results as insignificant because R would be comparing all the ecotypes to a bunch of zeroes.
#LATERAL ROOT NUMBER
zerosaltkruskalwallisrootnumber <- kruskal.test(LateralRootNumber~Variety, data = zerosalt)
zerosaltkruskalwallisrootnumber
## 
##  Kruskal-Wallis rank sum test
## 
## data:  LateralRootNumber by Variety
## Kruskal-Wallis chi-squared = 34.805, df = 4, p-value = 5.094e-07
dunnTest(LateralRootNumber ~ Variety,
         data = zerosalt,
         method = "bh")
## Warning: Variety was coerced to a factor.
## Dunn (1964) Kruskal-Wallis multiple comparison
##   p-values adjusted with the Benjamini-Hochberg method.
##        Comparison          Z      P.unadj        P.adj
## 1   Col-0 - Kew-1  3.3068454 9.435294e-04 2.358823e-03
## 2    Col-0 - Oy-0  1.7297348 8.367766e-02 9.297518e-02
## 3    Kew-1 - Oy-0 -1.8073773 7.070347e-02 1.010050e-01
## 4    Col-0 - Pa-1  1.8748365 6.081522e-02 1.013587e-01
## 5    Kew-1 - Pa-1 -1.7386104 8.210331e-02 1.026291e-01
## 6     Oy-0 - Pa-1  0.1125511 9.103864e-01 9.103864e-01
## 7  Col-0 - Tu-PK7 -2.2110323 2.703360e-02 5.406720e-02
## 8  Kew-1 - Tu-PK7 -5.3133246 1.076431e-07 1.076431e-06
## 9   Oy-0 - Tu-PK7 -3.9927986 6.529804e-05 2.176601e-04
## 10  Pa-1 - Tu-PK7 -4.1841845 2.861917e-05 1.430958e-04
eightysaltkruskalwallisrootnumber <- kruskal.test(LateralRootNumber~Variety, data = eightysalt)
eightysaltkruskalwallisrootnumber
## 
##  Kruskal-Wallis rank sum test
## 
## data:  LateralRootNumber by Variety
## Kruskal-Wallis chi-squared = 33.88, df = 4, p-value = 7.886e-07
dunnTest(LateralRootNumber ~ Variety,
         data = eightysalt,
         method = "bh")
## Warning: Variety was coerced to a factor.
## Dunn (1964) Kruskal-Wallis multiple comparison
##   p-values adjusted with the Benjamini-Hochberg method.
##        Comparison          Z      P.unadj        P.adj
## 1   Col-0 - Kew-1  1.7314923 8.336400e-02 1.190914e-01
## 2    Col-0 - Oy-0 -2.6344094 8.428380e-03 2.107095e-02
## 3    Kew-1 - Oy-0 -3.2795573 1.039701e-03 3.465670e-03
## 4    Col-0 - Pa-1  2.3539793 1.857364e-02 3.714729e-02
## 5    Kew-1 - Pa-1 -0.3511388 7.254843e-01 7.254843e-01
## 6     Oy-0 - Pa-1  5.3307046 9.783244e-08 9.783244e-07
## 7  Col-0 - Tu-PK7  0.6114232 5.409194e-01 6.010216e-01
## 8  Kew-1 - Tu-PK7 -1.3847725 1.661220e-01 2.076525e-01
## 9   Oy-0 - Tu-PK7  3.3969528 6.814071e-04 3.407035e-03
## 10  Pa-1 - Tu-PK7 -1.7903062 7.340469e-02 1.223412e-01
onehundredsixtysaltkruskalwallisrootnumber <- kruskal.test(LateralRootNumber~Variety, data = onehundredsixtysalt)
onehundredsixtysaltkruskalwallisrootnumber
## 
##  Kruskal-Wallis rank sum test
## 
## data:  LateralRootNumber by Variety
## Kruskal-Wallis chi-squared = 3.2098, df = 4, p-value = 0.5234
dunnTest(LateralRootNumber ~ Variety,
         data = onehundredsixtysalt,
         method = "bh")
## Warning: Variety was coerced to a factor.
## Dunn (1964) Kruskal-Wallis multiple comparison
##   p-values adjusted with the Benjamini-Hochberg method.
##        Comparison          Z   P.unadj     P.adj
## 1   Col-0 - Kew-1  0.0000000 1.0000000 1.0000000
## 2    Col-0 - Oy-0 -1.3659791 0.1719455 0.8597277
## 3    Kew-1 - Oy-0 -0.6637465 0.5068526 1.0000000
## 4    Col-0 - Pa-1  0.0000000 1.0000000 1.0000000
## 5    Kew-1 - Pa-1  0.0000000 1.0000000 1.0000000
## 6     Oy-0 - Pa-1  0.9018539 0.3671345 1.0000000
## 7  Col-0 - Tu-PK7  0.0000000 1.0000000 1.0000000
## 8  Kew-1 - Tu-PK7  0.0000000 1.0000000 1.0000000
## 9   Oy-0 - Tu-PK7  1.4919734 0.1357061 1.0000000
## 10  Pa-1 - Tu-PK7  0.0000000 1.0000000 1.0000000
tupk7lateralroot <- kruskal.test(LateralRootNumber ~ SaltConc, data = tupk7)
tupk7lateralroot
## 
##  Kruskal-Wallis rank sum test
## 
## data:  LateralRootNumber by SaltConc
## Kruskal-Wallis chi-squared = 24.104, df = 2, p-value = 5.831e-06
dunnTest(LateralRootNumber ~ as.factor(SaltConc), 
         data = tupk7, 
         method = "bh")
## Dunn (1964) Kruskal-Wallis multiple comparison
##   p-values adjusted with the Benjamini-Hochberg method.
##   Comparison         Z      P.unadj        P.adj
## 1    0 - 160  4.892255 9.968729e-07 2.990619e-06
## 2     0 - 80  2.670212 7.580342e-03 1.137051e-02
## 3   160 - 80 -2.374755 1.756060e-02 1.756060e-02