1 Set up

knitr::opts_chunk$set(
    echo = T,
    message = FALSE,
    warning = FALSE
)

1.1 1) Load packages

library(readxl)
library(dplyr)
library(tidyr)
library(ggplot2)
library(janitor)
library(grid)
library(ggthemes)

library(extrafont)
#font_import()
loadfonts(device = "win")
windowsFonts(Times = windowsFont("TT Times New Roman"))

library(lsmeans)
library(nlme)
library(car)
library(lme4)
library(multcomp)
library(lmerTest)
library(multcompView)
library(semPlot)
library(lavaan)
library(broom)
library(broom.mixed)
library(emmeans)

1.2 2) Import data

#import data
soilhealth <- read_excel("3-29-21 part 8 nrcs soil health.xlsx") 

#change column names
soilhealth <- soilhealth %>% 
  clean_names()
#str(soilhealth)
#View(soilhealth)

#convert variables to factors
soilhealth$nhorizon <- as.factor(soilhealth$nhorizon)
soilhealth$blk <- as.factor(soilhealth$blk)
soilhealth$horizon <- as.factor(soilhealth$horizon)
soilhealth$thorizon <- as.factor(soilhealth$thorizon)
soilhealth$rlanduse <- as.factor(soilhealth$rlanduse)
soilhealth$landuse <- as.factor(soilhealth$landuse)
soilhealth$prec <- as.factor(soilhealth$prec)
soilhealth$ag <- as.factor(soilhealth$ag)
soilhealth$tillage <- as.factor(soilhealth$tillage)

#convert variables to numeric
soilhealth$bdepth=as.numeric(soilhealth$bdepth)
soilhealth$precip <- as.numeric(soilhealth$precip)
soilhealth$t_np <- as.numeric(soilhealth$t_np)
soilhealth$to_cp <- as.numeric(soilhealth$to_cp)
soilhealth$ca <- as.numeric(soilhealth$ca)
soilhealth$cu <- as.numeric(soilhealth$cu)
soilhealth$mg <- as.numeric(soilhealth$mg)
soilhealth$mn <- as.numeric(soilhealth$mn)
soilhealth$na <- as.numeric(soilhealth$na)
soilhealth$p <- as.numeric(soilhealth$p)
soilhealth$p_h <- as.numeric(soilhealth$p_h)
soilhealth$k <- as.numeric(soilhealth$k)
soilhealth$zn <- as.numeric(soilhealth$zn)
soilhealth$fe <- as.numeric(soilhealth$fe)

#vartable(soilhealth)

1.3 3) Data Wrangling

# removes ottawa
soilhealth1 <- soilhealth %>%
  filter(location!="Ottawa") 

soilhealth1$landuse<- factor(soilhealth1$landuse,
                            levels = c(1,2,3),
                            labels = c("AG", "EA", "NP"))

#str(soilhealth1)

soilhealth1 <- as.data.frame(soilhealth1)

# soilhealth2 <- soilhealth1
# soilhealth2 <- soilhealth2[c(1,5,9,29,33,37,57,61,65,85,89,93,109,113,117,137,141,145,165,169,173,189,193,197,213,217,221),]
# #soilhealth2

# keep nutrients

nut <- soilhealth1 %>%
 dplyr::filter(location!="Ottawa") %>%
  dplyr::select(location, treatment, bdepth, horizon, blk, replication, landuse, precip, clay, nh4, no3, t_np, to_cp, ca, cu, mg, mn, na, p, p_h, k, zn, fe, gwc) %>%
  dplyr::mutate(cn=(to_cp/t_np), ca_g=(ca/1000))
#str(nut)
#summary(nut)
#vartable(nut)


# keeps aggregate data
agg <- soilhealth1 %>%
  dplyr::select(location, treatment, bdepth, horizon, blk, replication, landuse, precip, x20wsa2000, x20wsa250, x20wsa53, x20wsa20, x20mwd, x5wsa2000, x5wsa250, x5wsa53, x5wsa20, x5mwd, nagg, bd, clay)
#str(agg)
#summary(agg)
#plot(agg)
#vartable(agg)


# Keep respiration data, enzymes, proteins
# normalize the enzyme distributions

#vartable(agg)

epr <- soilhealth1 %>%
  dplyr::select(location, treatment, bdepth, horizon, blk, replication, landuse, precip, ac, glucosidase, glucosaminidase, acidphosphotase, alkphosphatase, arylsulfatase, phosphodiesterase, protein, respiration) %>%
  dplyr::mutate(lnac=log(ac), lngluc=log(glucosidase), lnglucosam=log(glucosaminidase), lnacidp=log(acidphosphotase), lnalkp=log(alkphosphatase), lnary=log(arylsulfatase), lnpho=log(phosphodiesterase), lnprotein=log(protein), lngluc_glucosam= (lngluc/lnglucosam), lngluc_acidp= (lngluc/lnacidp), lngluc_alkp=(lngluc/lnalkp), lngluc_pho=(lngluc/lnpho), lngluc_ary=(lngluc/lnary))
#str(epr)
#vartable(epr)


ratios <- soilhealth1 %>%
  dplyr::select(location, treatment, bdepth, horizon, blk, landuse, precip, replication, respiration, to_cg, t_nm, protein) %>%
  dplyr::mutate(t_ng=(t_nm/1000), ptn=(protein/t_ng), rec=(respiration/to_cg))
#vartable(ratios)
#To deal with egative natural log values from enzymes, I added 1.1 to each variable.

epr2 <- soilhealth1 %>%
  dplyr::select(location, treatment, bdepth, horizon, blk, landuse, precip, replication, ac, glucosidase, glucosaminidase, acidphosphotase, alkphosphatase, arylsulfatase, phosphodiesterase, protein, respiration) %>%
  mutate(lnac=log(ac), lngluc=log(glucosidase*100), lnglucosam=log(glucosaminidase*100), lnacidp=log(acidphosphotase*100), lnalkp=log(alkphosphatase*100), lnary=log(arylsulfatase*100), lnpho=log(phosphodiesterase*100), lnprotein=log(protein), lngluc_glucosam= (lngluc/lnglucosam), lngluc_acidp= (lngluc/lnacidp), lngluc_alkp=(lngluc/lnalkp), lngluc_pho=(lngluc/lnpho), lngluc_ary=(lngluc/lnary))

#summary(epr1)

1.4 4) Depth Wrangling

#remove IR from epr, epr2

epra <- epr %>%
  filter(treatment!="IR")

epra2 <- epr2 %>%
  filter(treatment!="IR")

#depth for biological

epra5 <- epra %>%
  filter(bdepth==5)
epra10 <- epra %>%
  filter(bdepth==10)
epra15 <- epra %>%
  filter(bdepth==15)

#remove IR from nut
nutr <- nut %>%
  filter(treatment!="IR")
  
#depth for chemical

nut5 <- nutr %>% 
  filter(bdepth==5)
nut10<- nutr %>% 
  filter(bdepth==10)
nut15<- nutr %>% 
  filter(bdepth==15)


#remove IR from agg
aggr <- agg %>% 
  filter(treatment!="IR")

#depth for phyisical

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

#depth for epr2 ratios
epra25 <- epra2 %>%
  filter(bdepth==5)
epra210 <- epra2 %>%
  filter(bdepth==10)
epra215 <- epra2 %>%
  filter(bdepth==15)

#depth for ratios
ratio5 <- ratios %>%
  filter(bdepth==5)
ratio10 <- ratios %>%
  filter(bdepth==10)
ratio15 <- ratios %>%
  filter(bdepth==15)

1.5 5) Theme James

library(grid)
library(ggthemes)

#fcol <- c( "AG" = "black", "EA" = "grey40", "NP" = "grey90", "IR"="blue")
#kstate purple - 512888
fcol <- c( "AG" = "#FF3333", "EA" = "#FF9933", "NP" = "#512888", "IR"="#0033FF")

colsnp <- c( "AG" = "black", "EA" = "grey40", "NP" = "grey90")

pd <- position_dodge(0.1)

theme_James <- function(base_size=14, base_family="TT Times New Roman") {
  (theme_foundation(base_size=base_size, base_family=base_family)+
      theme_bw()+ 
      theme(panel.background = element_rect(colour = NA),
            plot.background = element_rect(colour = NA),
            axis.title = element_text(color="black",size=rel(1.2)),
            axis.text = element_text(color="black", size = 12),
            legend.key = element_rect(colour = NA),
            legend.spacing = unit(0, "cm"),
            legend.text = element_text(size=12),
            legend.title = element_blank(),
            panel.grid = element_blank(),
            plot.title = element_text(color="Black",size = rel(1.5),face = "bold",hjust = 0.5),
            strip.text = element_text(color="Black",size = rel(1),face="bold")
      ))
}

1.6 Comments

x <- "0-5 cm"
y <- "5-10 cm"
z <- "10-15 cm"

l <- "natural log"

#Shapiro Wilks test

shapiro.test(aggr$x20mwd)
## 
##  Shapiro-Wilk normality test
## 
## data:  aggr$x20mwd
## W = 0.90548, p-value = 5.065e-11
# Shapiro-Wilk normality test
# 
# data:  aggr$x20mwd
# W = 0.90548, p-value = 5.065e-11


shapiro.test(aggr$x5mwd)
## 
##  Shapiro-Wilk normality test
## 
## data:  aggr$x5mwd
## W = 0.9076, p-value = 5.995e-08
# Shapiro-Wilk normality test
# 
# data:  aggr$x5mwd
# W = 0.9076, p-value = 5.995e-08

2 20 min Aggregate Graphs

2.1 0-5 cm 20 minutes

###20 mwd

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg5$precip <- as.factor(agg5$precip)
x20mwd <- lmer(x20mwd ~ landuse*precip + (1|replication), data=agg5, na.action=na.omit)
anova(x20mwd, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                 Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)    
## landuse        10.6851  5.3426     2    27 46.2074 1.919e-09 ***
## precip          0.0037  0.0018     2    27  0.0160    0.9842    
## landuse:precip  0.5627  0.1407     4    27  1.2166    0.3269    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x20mwd_means_tp <- lsmeans(x20mwd, specs = "landuse", by = "precip")

#PWC
x20mwd_pwc_tp <- cld(x20mwd_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x20mwd_pwc_tp <- as.data.frame(x20mwd_pwc_tp)
x20mwd_pwc_tp
##   landuse precip    lsmean        SE df    lower.CL  upper.CL .group
## 1      NP    472 1.6391185 0.1700156 27  1.29027523 1.9879618     a 
## 2      EA    472 0.7012615 0.1700156 27  0.35241823 1.0501048      b
## 3      AG    472 0.6816877 0.1700156 27  0.33284448 1.0305310      b
## 4      NP    579 1.8859738 0.1700156 27  1.53713048 2.2348170    a  
## 5      EA    579 0.7881320 0.1700156 27  0.43928873 1.1369753     b 
## 6      AG    579 0.2889481 0.1700156 27 -0.05989515 0.6377914      c
## 7      NP    850 1.7101955 0.1700156 27  1.36135223 2.0590388    a  
## 8      EA    850 0.9290419 0.1700156 27  0.58019863 1.2778852     b 
## 9      AG    850 0.3925357 0.1700156 27  0.04369248 0.7413790      c
#Determining the real SE

real_sex20mwd5cm <- agg5 %>%
  dplyr::group_by(precip, landuse) %>%
  dplyr::summarise( 
    n=n(),
    mean=mean(x20mwd),
    sd=sd(x20mwd)
  ) %>%
  dplyr::mutate( se=sd/sqrt(n))



#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

df<- merge(df, real_sex20mwd5cm, by=c("precip")) 


x20mwd5_pwc_tp_5v <- merge(x20mwd_pwc_tp, df, by=c("precip", "landuse"))
x20mwd5_pwc_tp_5v <- as.data.frame(x20mwd5_pwc_tp_5v)

x20mwd5_pwc_tp_5v
##   precip landuse    lsmean        SE df    lower.CL  upper.CL .group  location
## 1    472      AG 0.6816877 0.1700156 27  0.33284448 1.0305310      b   Tribune
## 2    472      EA 0.7012615 0.1700156 27  0.35241823 1.0501048      b   Tribune
## 3    472      NP 1.6391185 0.1700156 27  1.29027523 1.9879618     a    Tribune
## 4    579      AG 0.2889481 0.1700156 27 -0.05989515 0.6377914      c      Hays
## 5    579      EA 0.7881320 0.1700156 27  0.43928873 1.1369753     b       Hays
## 6    579      NP 1.8859738 0.1700156 27  1.53713048 2.2348170    a        Hays
## 7    850      AG 0.3925357 0.1700156 27  0.04369248 0.7413790      c Manhattan
## 8    850      EA 0.9290419 0.1700156 27  0.58019863 1.2778852     b  Manhattan
## 9    850      NP 1.7101955 0.1700156 27  1.36135223 2.0590388    a   Manhattan
##   n      mean         sd         se
## 1 4 0.6816878 0.34067898 0.17033949
## 2 4 0.7012615 0.07939717 0.03969858
## 3 4 1.6391185 0.63652059 0.31826030
## 4 4 0.2889481 0.06823212 0.03411606
## 5 4 0.7881320 0.07579000 0.03789500
## 6 4 1.8859738 0.38793154 0.19396577
## 7 4 0.3925358 0.11290835 0.05645417
## 8 4 0.9290419 0.18911734 0.09455867
## 9 4 1.7101955 0.55105588 0.27552794
x20mwd5_pwc_tp_5v$location_f =factor(x20mwd5_pwc_tp_5v$location, levels=c('Tribune', 'Hays', 'Manhattan'))



 ggplot(data=x20mwd5_pwc_tp_5v, aes(x=landuse, y=lsmean, fill = landuse)) + 
  geom_bar(position=position_dodge(), stat="identity", colour = "black") +
  geom_errorbar(aes(ymin=lsmean-se, ymax=lsmean+se),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9)) + 
  scale_y_continuous(limits=c(0,3)) +  
  facet_wrap(facets=vars(location_f), strip.position="bottom")  +
  xlab("")+
    facet_wrap(facets=vars(location_f), strip.position="bottom")  + 
  scale_fill_manual(values = colsnp) + 
     ggtitle("20 Minute MWD 0-5 cm by Land use and Precipitation")+ 
  theme_James() + 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        panel.border = element_rect(colour = "black", fill=NA, size=0.5),
        strip.background=element_rect(size=0.5, colour = "black"),
        axis.text.x=element_blank(),
        axis.ticks.x=element_blank(),
        legend.position= c(0.1,0.85)) +
labs(y=" Mean Weight Diameter (mm)") +
  geom_label(aes(label=trimws(.group), y = lsmean+.5),
            label.padding = unit(.3,"lines"), show.legend=NA , label.size = NA, fill=NA, font="bold") +
  guides(fill = guide_legend(override.aes = aes(label="")))

###8-2 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg5$precip <- as.factor(agg5$precip)
x20wsa2000 <- lmer(x20wsa2000 ~ treatment*precip + (1|replication), data=agg5, na.action=na.omit)
anova(x20wsa2000, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                  Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)    
## treatment        3614.3 1807.14     2    27 36.3110 2.216e-08 ***
## precip             17.6    8.80     2    27  0.1769    0.8388    
## treatment:precip  210.9   52.71     4    27  1.0592    0.3957    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x20wsa2000_means_tp <- lsmeans(x20wsa2000, specs = "treatment", by = "precip")

#PWC
x20wsa2000_pwc_tp <- cld(x20wsa2000_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x20wsa2000_pwc_tp <- as.data.frame(x20wsa2000_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x20wsa2000p<- merge(df, x20wsa2000_pwc_tp, by=c("precip")) 

x20wsa2000p$location_f =factor(x20wsa2000p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x20wsa2000p
##   precip  location treatment     lsmean       SE df  lower.CL  upper.CL .group
## 1    472   Tribune        NP 26.3313434 3.527336 27 19.093849 33.568838     a 
## 2    472   Tribune        EA  8.8448459 3.527336 27  1.607351 16.082341      b
## 3    472   Tribune        AG  8.7304187 3.527336 27  1.492924 15.967914      b
## 4    579      Hays        NP 30.8387700 3.527336 27 23.601275 38.076265     a 
## 5    579      Hays        EA  9.3305850 3.527336 27  2.093090 16.568080      b
## 6    579      Hays        AG  0.9315208 3.527336 27 -6.305974  8.169016      b
## 7    850 Manhattan        NP 25.3077401 3.527336 27 18.070245 32.545235     a 
## 8    850 Manhattan        EA 11.4886335 3.527336 27  4.251139 18.726128      b
## 9    850 Manhattan        AG  1.9782694 3.527336 27 -5.259225  9.215764      b
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan

2.1.1 2-0.250 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg5$precip <- as.factor(agg5$precip)
x20wsa250 <- lmer(x20wsa250 ~ treatment*precip + (1|replication), data=agg5, na.action=na.omit)
anova(x20wsa250, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF   DenDF F value    Pr(>F)    
## treatment        1511.80  755.90     2 20.3129 30.6394 7.358e-07 ***
## precip            330.72  165.36     2  8.5003  6.7026   0.01789 *  
## treatment:precip  117.76   29.44     4 20.3129  1.1933   0.34379    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x20wsa250_means_tp <- lsmeans(x20wsa250, specs = "treatment", by = "precip")

#PWC
x20wsa250_pwc_tp <- cld(x20wsa250_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x20wsa250_pwc_tp <- as.data.frame(x20wsa250_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x20wsa250p<- merge(df, x20wsa250_pwc_tp, by=c("precip")) 

x20wsa250p$location_f =factor(x20wsa250p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x20wsa250p
##   precip  location treatment   lsmean       SE      df  lower.CL upper.CL
## 1    472   Tribune        NP 25.60527 2.634026 25.7468 20.188356 31.02218
## 2    472   Tribune        EA 16.27820 2.634026 25.7468 10.861289 21.69511
## 3    472   Tribune        AG 14.44550 2.634026 25.7468  9.028589 19.86241
## 4    579      Hays        NP 28.53917 2.634026 25.7468 23.122260 33.95608
## 5    579      Hays        EA 22.02193 2.634026 25.7468 16.605020 27.43884
## 6    579      Hays        AG 11.97343 2.634026 25.7468  6.556520 17.39034
## 7    850 Manhattan        NP 37.24528 2.634026 25.7468 31.828368 42.66219
## 8    850 Manhattan        EA 24.97329 2.634026 25.7468 19.556377 30.39020
## 9    850 Manhattan        AG 17.62782 2.634026 25.7468 12.210914 23.04474
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4     a        Hays
## 5     a        Hays
## 6      b       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan

2.1.2 0.250-0.053 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg5$precip <- as.factor(agg5$precip)
x20wsa53 <- lmer(x20wsa53 ~ treatment*precip + (1|replication), data=agg5, na.action=na.omit)
anova(x20wsa53, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF   DenDF  F value    Pr(>F)    
## treatment        11892.9  5946.5     2 20.8198 136.2712 1.096e-12 ***
## precip              45.9    22.9     2  8.7658   0.5255   0.60879    
## treatment:precip   631.3   157.8     4 20.8198   3.6170   0.02169 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x20wsa53_means_tp <- lsmeans(x20wsa53, specs = "treatment", by = "precip")
x20wsa53_means_tp
## precip = 472:
##  treatment lsmean   SE   df lower.CL upper.CL
##  AG          53.1 3.74 22.8    45.34     60.8
##  EA          49.1 3.74 22.8    41.40     56.9
##  NP          22.3 3.74 22.8    14.56     30.0
## 
## precip = 579:
##  treatment lsmean   SE   df lower.CL upper.CL
##  AG          69.8 3.74 22.8    62.06     77.5
##  EA          47.9 3.74 22.8    40.20     55.7
##  NP          14.9 3.74 22.8     7.18     22.6
## 
## precip = 850:
##  treatment lsmean   SE   df lower.CL upper.CL
##  AG          61.2 3.74 22.8    53.43     68.9
##  EA          47.4 3.74 22.8    39.65     55.1
##  NP          16.6 3.74 22.8     8.83     24.3
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95
#PWC
x20wsa53_pwc_tp <- cld(x20wsa53_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x20wsa53_pwc_tp <- as.data.frame(x20wsa53_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x20wsa53p<- merge(df, x20wsa53_pwc_tp, by=c("precip")) 

x20wsa53p$location_f =factor(x20wsa53p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x20wsa53p
##   precip  location treatment   lsmean       SE       df  lower.CL upper.CL
## 1    472   Tribune        AG 53.07399 3.736594 22.78911 45.340296 60.80768
## 2    472   Tribune        EA 49.13078 3.736594 22.78911 41.397089 56.86447
## 3    472   Tribune        NP 22.29726 3.736594 22.78911 14.563572 30.03096
## 4    579      Hays        AG 69.79728 3.736594 22.78911 62.063591 77.53098
## 5    579      Hays        EA 47.93665 3.736594 22.78911 40.202952 55.67034
## 6    579      Hays        NP 14.90930 3.736594 22.78911  7.175602 22.64299
## 7    850 Manhattan        AG 61.16504 3.736594 22.78911 53.431345 68.89873
## 8    850 Manhattan        EA 47.38140 3.736594 22.78911 39.647708 55.11509
## 9    850 Manhattan        NP 16.56350 3.736594 22.78911  8.829805 24.29719
##   .group location_f
## 1     a     Tribune
## 2     a     Tribune
## 3      b    Tribune
## 4    a         Hays
## 5     b        Hays
## 6      c       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan

2.1.3 0.053-0.02 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg5$precip <- as.factor(agg5$precip)
x20wsa20 <- lmer(x20wsa20 ~ treatment*precip + (1|replication), data=agg5, na.action=na.omit)
anova(x20wsa20, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)    
## treatment        126.572  63.286     2    27 26.3225 4.548e-07 ***
## precip            14.220   7.110     2    27  2.9573   0.06897 .  
## treatment:precip   2.103   0.526     4    27  0.2187   0.92567    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x20wsa20_means_tp <- lsmeans(x20wsa20, specs = "treatment", by = "precip")
x20wsa20_means_tp
## precip = 472:
##  treatment lsmean    SE df lower.CL upper.CL
##  AG          6.16 0.775 27    4.567     7.75
##  EA          3.99 0.775 27    2.399     5.58
##  NP          1.95 0.775 27    0.359     3.54
## 
## precip = 579:
##  treatment lsmean    SE df lower.CL upper.CL
##  AG          5.28 0.775 27    3.692     6.87
##  EA          3.38 0.775 27    1.784     4.97
##  NP          1.05 0.775 27   -0.543     2.64
## 
## precip = 850:
##  treatment lsmean    SE df lower.CL upper.CL
##  AG          7.25 0.775 27    5.654     8.84
##  EA          5.14 0.775 27    3.554     6.74
##  NP          1.93 0.775 27    0.342     3.52
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95
#PWC
x20wsa20_pwc_tp <- cld(x20wsa20_means_tp, adjust = "none", Letters = letters, reversed = T)

x20wsa20_pwc_tp
## precip = 472:
##  treatment lsmean    SE df lower.CL upper.CL .group
##  AG          6.16 0.775 27    4.567     7.75  a    
##  EA          3.99 0.775 27    2.399     5.58  ab   
##  NP          1.95 0.775 27    0.359     3.54   b   
## 
## precip = 579:
##  treatment lsmean    SE df lower.CL upper.CL .group
##  AG          5.28 0.775 27    3.692     6.87  a    
##  EA          3.38 0.775 27    1.784     4.97  a    
##  NP          1.05 0.775 27   -0.543     2.64   b   
## 
## precip = 850:
##  treatment lsmean    SE df lower.CL upper.CL .group
##  AG          7.25 0.775 27    5.654     8.84  a    
##  EA          5.14 0.775 27    3.554     6.74  a    
##  NP          1.93 0.775 27    0.342     3.52   b   
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95 
## significance level used: alpha = 0.05 
## NOTE: Compact letter displays can be misleading
##       because they show NON-findings rather than findings.
##       Consider using 'pairs()', 'pwpp()', or 'pwpm()' instead.
#transforming it in a data frame to use on ggplot
x20wsa20_pwc_tp <- as.data.frame(x20wsa20_pwc_tp)
x20wsa20_pwc_tp
##   treatment precip lsmean        SE df   lower.CL upper.CL .group
## 3        AG    472 6.1575 0.7752837 27  4.5667492 7.748251     a 
## 2        EA    472 3.9900 0.7752837 27  2.3992492 5.580751     ab
## 1        NP    472 1.9500 0.7752837 27  0.3592492 3.540751      b
## 6        AG    579 5.2825 0.7752837 27  3.6917492 6.873251     a 
## 5        EA    579 3.3750 0.7752837 27  1.7842492 4.965751     a 
## 4        NP    579 1.0475 0.7752837 27 -0.5432508 2.638251      b
## 9        AG    850 7.2450 0.7752837 27  5.6542492 8.835751     a 
## 8        EA    850 5.1450 0.7752837 27  3.5542492 6.735751     a 
## 7        NP    850 1.9325 0.7752837 27  0.3417492 3.523251      b
#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x20wsa20p<- merge(df, x20wsa20_pwc_tp, by=c("precip")) 

x20wsa20p$location_f =factor(x20wsa20p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x20wsa20p
##   precip  location treatment lsmean        SE df   lower.CL upper.CL .group
## 1    472   Tribune        AG 6.1575 0.7752837 27  4.5667492 7.748251     a 
## 2    472   Tribune        EA 3.9900 0.7752837 27  2.3992492 5.580751     ab
## 3    472   Tribune        NP 1.9500 0.7752837 27  0.3592492 3.540751      b
## 4    579      Hays        AG 5.2825 0.7752837 27  3.6917492 6.873251     a 
## 5    579      Hays        EA 3.3750 0.7752837 27  1.7842492 4.965751     a 
## 6    579      Hays        NP 1.0475 0.7752837 27 -0.5432508 2.638251      b
## 7    850 Manhattan        AG 7.2450 0.7752837 27  5.6542492 8.835751     a 
## 8    850 Manhattan        EA 5.1450 0.7752837 27  3.5542492 6.735751     a 
## 9    850 Manhattan        NP 1.9325 0.7752837 27  0.3417492 3.523251      b
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan

2.2 5-10 cm 20 minutes

###8-2 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg10$precip <- as.factor(agg10$precip)
x20wsa200010 <- lmer(x20wsa2000 ~ treatment*precip + (1|replication), data=agg10, na.action=na.omit)
anova(x20wsa200010, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)    
## treatment        2616.00 1308.00     2    27 75.5924 8.643e-12 ***
## precip             12.68    6.34     2    27  0.3665  0.696579    
## treatment:precip  311.07   77.77     4    27  4.4944  0.006514 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x20wsa200010_means_tp <- lsmeans(x20wsa200010, specs = "treatment", by = "precip")

#PWC
x20wsa200010_pwc_tp <- cld(x20wsa200010_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x20wsa200010_pwc_tp <- as.data.frame(x20wsa200010_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x20wsa200010p<- merge(df, x20wsa200010_pwc_tp, by=c("precip")) 

x20wsa200010p$location_f =factor(x20wsa200010p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x20wsa200010p
##   precip  location treatment    lsmean       SE df    lower.CL  upper.CL .group
## 1    472   Tribune        NP 19.874634 2.079862 27 15.60710952 24.142159     a 
## 2    472   Tribune        AG  7.158672 2.079862 27  2.89114749 11.426197      b
## 3    472   Tribune        EA  2.303734 2.079862 27 -1.96379035  6.571259      b
## 4    579      Hays        NP 27.933098 2.079862 27 23.66557284 32.200622     a 
## 5    579      Hays        EA  4.312530 2.079862 27  0.04500509  8.580054      b
## 6    579      Hays        AG  1.369402 2.079862 27 -2.89812306  5.636926      b
## 7    850 Manhattan        NP 19.539639 2.079862 27 15.27211447 23.807164     a 
## 8    850 Manhattan        EA  8.197339 2.079862 27  3.92981461 12.464864      b
## 9    850 Manhattan        AG  3.003322 2.079862 27 -1.26420295  7.270846      b
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan

2.2.1 2-0.250 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg10$precip <- as.factor(agg10$precip)
x20wsa25010 <- lmer(x20wsa250 ~ treatment*precip + (1|replication), data=agg10, na.action=na.omit)
anova(x20wsa25010, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF  DenDF F value  Pr(>F)  
## treatment         547.76  273.88     2 24.547  3.0591 0.06513 .
## precip            319.85  159.93     2 22.179  1.7863 0.19085  
## treatment:precip 1341.29  335.32     4 23.861  3.7454 0.01673 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x20wsa25010_means_tp <- lsmeans(x20wsa25010, specs = "treatment", by = "precip")

#PWC
x20wsa25010_pwc_tp <- cld(x20wsa25010_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x20wsa25010_pwc_tp <- as.data.frame(x20wsa25010_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x20wsa25010p<- merge(df, x20wsa25010_pwc_tp, by=c("precip")) 

x20wsa25010p$location_f =factor(x20wsa25010p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x20wsa25010p
##   precip  location treatment   lsmean       SE       df  lower.CL upper.CL
## 1    472   Tribune        NP 33.76226 4.905017 26.37839 23.686887 43.83763
## 2    472   Tribune        AG 31.38025 4.905017 26.37839 21.304875 41.45562
## 3    472   Tribune        EA 15.88541 4.905017 26.37839  5.810033 25.96078
## 4    579      Hays        EA 29.76832 4.905017 26.37839 19.692944 39.84369
## 5    579      Hays        NP 22.88141 4.905017 26.37839 12.806039 32.95679
## 6    579      Hays        AG 12.44605 4.905017 26.37839  2.370679 22.52143
## 7    850 Manhattan        NP 35.21192 4.905017 26.37839 25.136550 45.28730
## 8    850 Manhattan        EA 31.98805 4.905017 26.37839 21.912672 42.06342
## 9    850 Manhattan        AG 19.00936 4.905017 26.37839  8.933983 29.08473
##   .group location_f
## 1     a     Tribune
## 2     a     Tribune
## 3      b    Tribune
## 4     a        Hays
## 5     ab       Hays
## 6      b       Hays
## 7     a   Manhattan
## 8     ab  Manhattan
## 9      b  Manhattan

2.2.2 0.250-0.053 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg10$precip <- as.factor(agg10$precip)
x20wsa5310 <- lmer(x20wsa53 ~ treatment*precip + (1|replication), data=agg10, na.action=na.omit)
anova(x20wsa5310, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                  Sum Sq Mean Sq NumDF  DenDF F value    Pr(>F)    
## treatment        5648.5 2824.26     2 24.246 39.1889 2.533e-08 ***
## precip             75.7   37.83     2 16.940  0.5250  0.600891    
## treatment:precip 1338.3  334.58     4 22.291  4.6426  0.007072 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x20wsa5310_means_tp <- lsmeans(x20wsa5310, specs = "treatment", by = "precip")
x20wsa5310_means_tp
## precip = 472:
##  treatment lsmean   SE df lower.CL upper.CL
##  AG          40.3 4.91 21     30.1     50.5
##  EA          60.5 4.91 21     50.3     70.7
##  NP          24.3 4.91 21     14.1     34.5
## 
## precip = 579:
##  treatment lsmean   SE df lower.CL upper.CL
##  AG          61.0 4.91 21     50.8     71.2
##  EA          47.5 4.91 21     37.3     57.7
##  NP          28.4 4.91 21     18.2     38.6
## 
## precip = 850:
##  treatment lsmean   SE df lower.CL upper.CL
##  AG          60.5 4.91 21     50.3     70.7
##  EA          45.0 4.91 21     34.8     55.2
##  NP          23.6 4.91 21     13.4     33.8
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95
#PWC
x20wsa5310_pwc_tp <- cld(x20wsa5310_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x20wsa5310_pwc_tp <- as.data.frame(x20wsa5310_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x20wsa5310p<- merge(df, x20wsa5310_pwc_tp, by=c("precip")) 

x20wsa5310p$location_f =factor(x20wsa5310p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x20wsa5310p
##   precip  location treatment   lsmean       SE       df lower.CL upper.CL
## 1    472   Tribune        EA 60.53863 4.905302 20.96793 50.33654 70.74071
## 2    472   Tribune        AG 40.25275 4.905302 20.96793 30.05067 50.45484
## 3    472   Tribune        NP 24.33689 4.905302 20.96793 14.13481 34.53898
## 4    579      Hays        AG 61.04155 4.905302 20.96793 50.83947 71.24364
## 5    579      Hays        EA 47.54742 4.905302 20.96793 37.34533 57.74950
## 6    579      Hays        NP 28.36159 4.905302 20.96793 18.15950 38.56367
## 7    850 Manhattan        AG 60.48042 4.905302 20.96793 50.27834 70.68251
## 8    850 Manhattan        EA 45.04338 4.905302 20.96793 34.84130 55.24547
## 9    850 Manhattan        NP 23.59988 4.905302 20.96793 13.39779 33.80196
##   .group location_f
## 1    a      Tribune
## 2     b     Tribune
## 3      c    Tribune
## 4    a         Hays
## 5     b        Hays
## 6      c       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan

2.2.3 0.053-0.02 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg10$precip <- as.factor(agg10$precip)
x20wsa2010 <- lmer(x20wsa20 ~ treatment*precip + (1|replication), data=agg10, na.action=na.omit)
anova(x20wsa2010, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                  Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)    
## treatment        79.773  39.886     2    27 22.0949 2.069e-06 ***
## precip            4.560   2.280     2    27  1.2630 0.2989752    
## treatment:precip 55.436  13.859     4    27  7.6771 0.0002882 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x20wsa2010_means_tp <- lsmeans(x20wsa2010, specs = "treatment", by = "precip")
x20wsa2010_means_tp
## precip = 472:
##  treatment lsmean    SE df lower.CL upper.CL
##  AG          4.11 0.672 27    2.729     5.49
##  EA          5.41 0.672 27    4.032     6.79
##  NP          2.18 0.672 27    0.804     3.56
## 
## precip = 579:
##  treatment lsmean    SE df lower.CL upper.CL
##  AG          8.78 0.672 27    7.399    10.16
##  EA          3.78 0.672 27    2.399     5.16
##  NP          1.76 0.672 27    0.379     3.14
## 
## precip = 850:
##  treatment lsmean    SE df lower.CL upper.CL
##  AG          4.81 0.672 27    3.434     6.19
##  EA          5.05 0.672 27    3.669     6.43
##  NP          3.04 0.672 27    1.662     4.42
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95
#PWC
x20wsa2010_pwc_tp <- cld(x20wsa2010_means_tp, adjust = "none", Letters = letters, reversed = T)

x20wsa2010_pwc_tp
## precip = 472:
##  treatment lsmean    SE df lower.CL upper.CL .group
##  EA          5.41 0.672 27    4.032     6.79  a    
##  AG          4.11 0.672 27    2.729     5.49  ab   
##  NP          2.18 0.672 27    0.804     3.56   b   
## 
## precip = 579:
##  treatment lsmean    SE df lower.CL upper.CL .group
##  AG          8.78 0.672 27    7.399    10.16  a    
##  EA          3.78 0.672 27    2.399     5.16   b   
##  NP          1.76 0.672 27    0.379     3.14    c  
## 
## precip = 850:
##  treatment lsmean    SE df lower.CL upper.CL .group
##  EA          5.05 0.672 27    3.669     6.43  a    
##  AG          4.81 0.672 27    3.434     6.19  ab   
##  NP          3.04 0.672 27    1.662     4.42   b   
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95 
## significance level used: alpha = 0.05 
## NOTE: Compact letter displays can be misleading
##       because they show NON-findings rather than findings.
##       Consider using 'pairs()', 'pwpp()', or 'pwpm()' instead.
#transforming it in a data frame to use on ggplot
x20wsa2010_pwc_tp <- as.data.frame(x20wsa2010_pwc_tp)
x20wsa2010_pwc_tp
##   treatment precip lsmean       SE df  lower.CL upper.CL .group
## 3        EA    472 5.4100 0.671795 27 4.0315905  6.78841     a 
## 1        AG    472 4.1075 0.671795 27 2.7290905  5.48591     ab
## 2        NP    472 2.1825 0.671795 27 0.8040905  3.56091      b
## 6        AG    579 8.7775 0.671795 27 7.3990905 10.15591    a  
## 5        EA    579 3.7775 0.671795 27 2.3990905  5.15591     b 
## 4        NP    579 1.7575 0.671795 27 0.3790905  3.13591      c
## 9        EA    850 5.0475 0.671795 27 3.6690905  6.42591     a 
## 7        AG    850 4.8125 0.671795 27 3.4340905  6.19091     ab
## 8        NP    850 3.0400 0.671795 27 1.6615905  4.41841      b
#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x20wsa2010p<- merge(df, x20wsa2010_pwc_tp, by=c("precip")) 

x20wsa2010p$location_f =factor(x20wsa2010p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x20wsa2010p
##   precip  location treatment lsmean       SE df  lower.CL upper.CL .group
## 1    472   Tribune        EA 5.4100 0.671795 27 4.0315905  6.78841     a 
## 2    472   Tribune        AG 4.1075 0.671795 27 2.7290905  5.48591     ab
## 3    472   Tribune        NP 2.1825 0.671795 27 0.8040905  3.56091      b
## 4    579      Hays        AG 8.7775 0.671795 27 7.3990905 10.15591    a  
## 5    579      Hays        EA 3.7775 0.671795 27 2.3990905  5.15591     b 
## 6    579      Hays        NP 1.7575 0.671795 27 0.3790905  3.13591      c
## 7    850 Manhattan        EA 5.0475 0.671795 27 3.6690905  6.42591     a 
## 8    850 Manhattan        AG 4.8125 0.671795 27 3.4340905  6.19091     ab
## 9    850 Manhattan        NP 3.0400 0.671795 27 1.6615905  4.41841      b
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan

2.3 10-15 cm 20 minutes

###8-2 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg15$precip <- as.factor(agg15$precip)
x20wsa200015 <- lmer(x20wsa2000 ~ treatment*precip + (1|replication), data=agg15, na.action=na.omit)
anova(x20wsa200015, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                  Sum Sq Mean Sq NumDF DenDF  F value    Pr(>F)    
## treatment        3708.8 1854.41     2    27 128.1703 1.649e-14 ***
## precip             46.3   23.17     2    27   1.6012    0.2202    
## treatment:precip   41.8   10.45     4    27   0.7222    0.5844    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x20wsa200015_means_tp <- lsmeans(x20wsa200015, specs = "treatment", by = "precip")

#PWC
x20wsa200015_pwc_tp <- cld(x20wsa200015_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x20wsa200015_pwc_tp <- as.data.frame(x20wsa200015_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x20wsa200015p<- merge(df, x20wsa200015_pwc_tp, by=c("precip")) 

x20wsa200015p$location_f =factor(x20wsa200015p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x20wsa200015p
##   precip  location treatment    lsmean       SE df   lower.CL  upper.CL .group
## 1    472   Tribune        NP 26.297002 1.901863 27 22.3947003 30.199303     a 
## 2    472   Tribune        AG  7.344079 1.901863 27  3.4417780 11.246381      b
## 3    472   Tribune        EA  3.058975 1.901863 27 -0.8433266  6.961276      b
## 4    579      Hays        NP 23.871558 1.901863 27 19.9692562 27.773859     a 
## 5    579      Hays        EA  2.561610 1.901863 27 -1.3406916  6.463911      b
## 6    579      Hays        AG  1.931631 1.901863 27 -1.9706708  5.833932      b
## 7    850 Manhattan        NP 25.368150 1.901863 27 21.4658488 29.270451     a 
## 8    850 Manhattan        EA  4.378598 1.901863 27  0.4762962  8.280899      b
## 9    850 Manhattan        AG  2.653159 1.901863 27 -1.2491423  6.555460      b
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan

2.3.1 2-0.250 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg15$precip <- as.factor(agg15$precip)
x20wsa25015 <- lmer(x20wsa250 ~ treatment*precip + (1|replication), data=agg15, na.action=na.omit)
anova(x20wsa25015, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                  Sum Sq Mean Sq NumDF  DenDF F value  Pr(>F)  
## treatment        832.09  416.05     2 22.322  4.4308 0.02396 *
## precip           253.13  126.56     2 11.356  1.3479 0.29837  
## treatment:precip 396.69   99.17     4 22.322  1.0562 0.40112  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x20wsa25015_means_tp <- lsmeans(x20wsa25015, specs = "treatment", by = "precip")

#PWC
x20wsa25015_pwc_tp <- cld(x20wsa25015_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x20wsa25015_pwc_tp <- as.data.frame(x20wsa25015_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x20wsa25015p<- merge(df, x20wsa25015_pwc_tp, by=c("precip")) 

x20wsa25015p$location_f =factor(x20wsa25015p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x20wsa25015p
##   precip  location treatment   lsmean       SE       df  lower.CL upper.CL
## 1    472   Tribune        NP 31.52114 5.299915 24.42448 20.592709 42.44958
## 2    472   Tribune        AG 27.33366 5.299915 24.42448 16.405226 38.26210
## 3    472   Tribune        EA 15.88228 5.299915 24.42448  4.953841 26.81071
## 4    579      Hays        AG 32.94085 5.299915 24.42448 22.012414 43.86929
## 5    579      Hays        NP 23.26334 5.299915 24.42448 12.334906 34.19178
## 6    579      Hays        EA 18.86667 5.299915 24.42448  7.938236 29.79511
## 7    850 Manhattan        NP 37.56309 5.299915 24.42448 26.634649 48.49152
## 8    850 Manhattan        AG 29.49422 5.299915 24.42448 18.565782 40.42265
## 9    850 Manhattan        EA 25.79500 5.299915 24.42448 14.866564 36.72344
##   .group location_f
## 1     a     Tribune
## 2     ab    Tribune
## 3      b    Tribune
## 4      a       Hays
## 5      a       Hays
## 6      a       Hays
## 7      a  Manhattan
## 8      a  Manhattan
## 9      a  Manhattan

2.3.2 0.250-0.053 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg15$precip <- as.factor(agg15$precip)
x20wsa5315 <- lmer(x20wsa53 ~ treatment*precip + (1|replication), data=agg15, na.action=na.omit)
anova(x20wsa5315, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                  Sum Sq Mean Sq NumDF  DenDF F value    Pr(>F)    
## treatment        5954.3 2977.14     2 22.126 25.8975 1.601e-06 ***
## precip            236.0  117.98     2 11.493  1.0263    0.3890    
## treatment:precip  588.3  147.08     4 22.126  1.2794    0.3081    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x20wsa5315_means_tp <- lsmeans(x20wsa5315, specs = "treatment", by = "precip")
x20wsa5315_means_tp
## precip = 472:
##  treatment lsmean   SE   df lower.CL upper.CL
##  AG          43.9 5.59 26.4    32.38     55.3
##  EA          51.1 5.59 26.4    39.65     62.6
##  NP          20.9 5.59 26.4     9.40     32.3
## 
## precip = 579:
##  treatment lsmean   SE   df lower.CL upper.CL
##  AG          44.0 5.59 26.4    32.56     55.5
##  EA          60.0 5.59 26.4    48.51     71.5
##  NP          32.7 5.59 26.4    21.21     44.2
## 
## precip = 850:
##  treatment lsmean   SE   df lower.CL upper.CL
##  AG          54.0 5.59 26.4    42.57     65.5
##  EA          52.4 5.59 26.4    40.89     63.8
##  NP          19.5 5.59 26.4     7.98     30.9
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95
#PWC
x20wsa5315_pwc_tp <- cld(x20wsa5315_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x20wsa5315_pwc_tp <- as.data.frame(x20wsa5315_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x20wsa5315p<- merge(df, x20wsa5315_pwc_tp, by=c("precip")) 

x20wsa5315p$location_f =factor(x20wsa5315p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x20wsa5315p
##   precip  location treatment   lsmean       SE      df  lower.CL upper.CL
## 1    472   Tribune        EA 51.12957 5.586198 26.3469 39.654327 62.60481
## 2    472   Tribune        AG 43.85542 5.586198 26.3469 32.380181 55.33066
## 3    472   Tribune        NP 20.87374 5.586198 26.3469  9.398503 32.34898
## 4    579      Hays        EA 59.98533 5.586198 26.3469 48.510085 71.46056
## 5    579      Hays        AG 44.03529 5.586198 26.3469 32.560046 55.51053
## 6    579      Hays        NP 32.68928 5.586198 26.3469 21.214043 44.16452
## 7    850 Manhattan        AG 54.04183 5.586198 26.3469 42.566587 65.51707
## 8    850 Manhattan        EA 52.36527 5.586198 26.3469 40.890028 63.84051
## 9    850 Manhattan        NP 19.45423 5.586198 26.3469  7.978991 30.92947
##   .group location_f
## 1     a     Tribune
## 2     a     Tribune
## 3      b    Tribune
## 4     a        Hays
## 5      b       Hays
## 6      b       Hays
## 7     a   Manhattan
## 8     a   Manhattan
## 9      b  Manhattan

2.3.3 0.053-0.02 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg15$precip <- as.factor(agg15$precip)
x20wsa2015 <- lmer(x20wsa20 ~ treatment*precip + (1|replication), data=agg15, na.action=na.omit)
anova(x20wsa2015, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF   DenDF F value    Pr(>F)    
## treatment        157.687  78.844     2 18.9916 21.2369 1.434e-05 ***
## precip             9.154   4.577     2  6.5278  1.2328   0.35141    
## treatment:precip  50.755  12.689     4 18.9916  3.4178   0.02888 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x20wsa2015_means_tp <- lsmeans(x20wsa2015, specs = "treatment", by = "precip")
x20wsa2015_means_tp
## precip = 472:
##  treatment lsmean   SE   df lower.CL upper.CL
##  AG          4.41 1.09 22.6    2.146     6.68
##  EA          8.42 1.09 22.6    6.156    10.69
##  NP          1.61 1.09 22.6   -0.651     3.88
## 
## precip = 579:
##  treatment lsmean   SE   df lower.CL upper.CL
##  AG          7.83 1.09 22.6    5.561    10.09
##  EA          5.56 1.09 22.6    3.296     7.83
##  NP          2.44 1.09 22.6    0.174     4.71
## 
## precip = 850:
##  treatment lsmean   SE   df lower.CL upper.CL
##  AG          3.47 1.09 22.6    1.204     5.74
##  EA          6.94 1.09 22.6    4.674     9.21
##  NP          1.73 1.09 22.6   -0.534     4.00
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95
#PWC
x20wsa2015_pwc_tp <- cld(x20wsa2015_means_tp, adjust = "none", Letters = letters, reversed = T)

x20wsa2015_pwc_tp
## precip = 472:
##  treatment lsmean   SE   df lower.CL upper.CL .group
##  EA          8.42 1.09 22.6    6.156    10.69  a    
##  AG          4.41 1.09 22.6    2.146     6.68   b   
##  NP          1.61 1.09 22.6   -0.651     3.88   b   
## 
## precip = 579:
##  treatment lsmean   SE   df lower.CL upper.CL .group
##  AG          7.83 1.09 22.6    5.561    10.09  a    
##  EA          5.56 1.09 22.6    3.296     7.83  a    
##  NP          2.44 1.09 22.6    0.174     4.71   b   
## 
## precip = 850:
##  treatment lsmean   SE   df lower.CL upper.CL .group
##  EA          6.94 1.09 22.6    4.674     9.21  a    
##  AG          3.47 1.09 22.6    1.204     5.74   b   
##  NP          1.73 1.09 22.6   -0.534     4.00   b   
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95 
## significance level used: alpha = 0.05 
## NOTE: Compact letter displays can be misleading
##       because they show NON-findings rather than findings.
##       Consider using 'pairs()', 'pwpp()', or 'pwpm()' instead.
#transforming it in a data frame to use on ggplot
x20wsa2015_pwc_tp <- as.data.frame(x20wsa2015_pwc_tp)
x20wsa2015_pwc_tp
##   treatment precip lsmean       SE       df   lower.CL  upper.CL .group
## 3        EA    472 8.4225 1.094354 22.58634  6.1563605 10.688639     a 
## 1        AG    472 4.4125 1.094354 22.58634  2.1463605  6.678639      b
## 2        NP    472 1.6150 1.094354 22.58634 -0.6511395  3.881139      b
## 6        AG    579 7.8275 1.094354 22.58634  5.5613605 10.093639     a 
## 5        EA    579 5.5625 1.094354 22.58634  3.2963605  7.828639     a 
## 4        NP    579 2.4400 1.094354 22.58634  0.1738605  4.706139      b
## 9        EA    850 6.9400 1.094354 22.58634  4.6738605  9.206139     a 
## 7        AG    850 3.4700 1.094354 22.58634  1.2038605  5.736139      b
## 8        NP    850 1.7325 1.094354 22.58634 -0.5336395  3.998639      b
#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x20wsa2015p<- merge(df, x20wsa2015_pwc_tp, by=c("precip")) 

x20wsa2015p$location_f =factor(x20wsa2015p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x20wsa2015p
##   precip  location treatment lsmean       SE       df   lower.CL  upper.CL
## 1    472   Tribune        EA 8.4225 1.094354 22.58634  6.1563605 10.688639
## 2    472   Tribune        AG 4.4125 1.094354 22.58634  2.1463605  6.678639
## 3    472   Tribune        NP 1.6150 1.094354 22.58634 -0.6511395  3.881139
## 4    579      Hays        AG 7.8275 1.094354 22.58634  5.5613605 10.093639
## 5    579      Hays        EA 5.5625 1.094354 22.58634  3.2963605  7.828639
## 6    579      Hays        NP 2.4400 1.094354 22.58634  0.1738605  4.706139
## 7    850 Manhattan        EA 6.9400 1.094354 22.58634  4.6738605  9.206139
## 8    850 Manhattan        AG 3.4700 1.094354 22.58634  1.2038605  5.736139
## 9    850 Manhattan        NP 1.7325 1.094354 22.58634 -0.5336395  3.998639
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4     a        Hays
## 5     a        Hays
## 6      b       Hays
## 7     a   Manhattan
## 8      b  Manhattan
## 9      b  Manhattan

3 5 min Aggregate Graphs

3.1 0-5 cm 5 minutes

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg5$precip <- as.factor(agg5$precip)
x5mwd <- lmer(x5mwd ~ landuse*precip + (1|replication), data=agg5, na.action=na.omit)
anova(x5mwd, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                Sum Sq Mean Sq NumDF   DenDF F value    Pr(>F)    
## landuse        9.0889  4.5444     2 20.7855 147.735 5.163e-13 ***
## precip         1.9281  0.9641     2  8.4263  31.341 0.0001252 ***
## landuse:precip 3.5555  0.8889     4 20.7855  28.896 3.171e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x5mwd_means_tp <- lsmeans(x5mwd, specs = "landuse", by = "precip")

#PWC
x5mwd_pwc_tp <- cld(x5mwd_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x5mwd_pwc_tp <- as.data.frame(x5mwd_pwc_tp)
x5mwd_pwc_tp
##   landuse precip    lsmean        SE       df  lower.CL  upper.CL .group
## 1      EA    472 0.8730867 0.1153711 16.22468 0.6287858 1.1173875     a 
## 3      NP    472 0.7705144 0.1153711 16.22468 0.5262135 1.0148152     a 
## 2      AG    472 0.4969844 0.1153711 16.22468 0.2526835 0.7412853      b
## 4      NP    579 2.5919444 0.1153711 16.22468 2.3476436 2.8362453    a  
## 5      EA    579 1.6406292 0.1153711 16.22468 1.3963283 1.8849301     b 
## 6      AG    579 0.4614811 0.1153711 16.22468 0.2171802 0.7057820      c
## 7      NP    850 1.7832866 0.1153711 16.22468 1.5389857 2.0275875    a  
## 8      EA    850 1.1125858 0.1153711 16.22468 0.8682849 1.3568867     b 
## 9      AG    850 0.5132084 0.1153711 16.22468 0.2689075 0.7575093      c
#Determining the real SE

real_sex5mwd5cm <- agg5 %>%
  dplyr::group_by(precip, landuse) %>%
  dplyr::summarise( 
    n=n(),
    mean=mean(x5mwd),
    sd=sd(x5mwd)
  ) %>%
  dplyr::mutate( se=sd/sqrt(n))



#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

df<- merge(df, real_sex5mwd5cm, by=c("precip")) 


x5mwd5_pwc_tp_5v <- merge(x5mwd_pwc_tp, df, by=c("precip", "landuse"))
x5mwd5_pwc_tp_5v <- as.data.frame(x5mwd5_pwc_tp_5v)

x5mwd5_pwc_tp_5v
##   precip landuse    lsmean        SE       df  lower.CL  upper.CL .group
## 1    472      AG 0.4969844 0.1153711 16.22468 0.2526835 0.7412853      b
## 2    472      EA 0.8730867 0.1153711 16.22468 0.6287858 1.1173875     a 
## 3    472      NP 0.7705144 0.1153711 16.22468 0.5262135 1.0148152     a 
## 4    579      AG 0.4614811 0.1153711 16.22468 0.2171802 0.7057820      c
## 5    579      EA 1.6406292 0.1153711 16.22468 1.3963283 1.8849301     b 
## 6    579      NP 2.5919444 0.1153711 16.22468 2.3476436 2.8362453    a  
## 7    850      AG 0.5132084 0.1153711 16.22468 0.2689075 0.7575093      c
## 8    850      EA 1.1125858 0.1153711 16.22468 0.8682849 1.3568867     b 
## 9    850      NP 1.7832866 0.1153711 16.22468 1.5389857 2.0275875    a  
##    location n      mean         sd         se
## 1   Tribune 4 0.4969844 0.20872366 0.10436183
## 2   Tribune 4 0.8730867 0.34450024 0.17225012
## 3   Tribune 4 0.7705144 0.09091499 0.04545750
## 4      Hays 4 0.4614811 0.11490948 0.05745474
## 5      Hays 4 1.6406292 0.14262624 0.07131312
## 6      Hays 4 2.5919444 0.32999554 0.16499777
## 7 Manhattan 4 0.5132084 0.07644064 0.03822032
## 8 Manhattan 4 1.1125858 0.08289555 0.04144778
## 9 Manhattan 4 1.7832866 0.37560090 0.18780045
x5mwd5_pwc_tp_5v$location_f =factor(x5mwd5_pwc_tp_5v$location, levels=c('Tribune', 'Hays', 'Manhattan'))



 ggplot(data=x5mwd5_pwc_tp_5v, aes(x=landuse, y=lsmean, fill = landuse)) + 
  geom_bar(position=position_dodge(), stat="identity", colour = "black") +
  geom_errorbar(aes(ymin=lsmean-se, ymax=lsmean+se),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9)) + 
  scale_y_continuous(limits=c(0,3.5)) +  
  facet_wrap(facets=vars(location_f), strip.position="bottom")  +
  xlab("")+
    facet_wrap(facets=vars(location_f), strip.position="bottom")  + 
  scale_fill_manual(values = colsnp) + 
     ggtitle("5 Minute MWD 0-5 cm by Land use and Precipitation")+ 
  theme_James() + 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        panel.border = element_rect(colour = "black", fill=NA, size=0.5),
        strip.background=element_rect(size=0.5, colour = "black"),
        axis.text.x=element_blank(),
        axis.ticks.x=element_blank(),
        legend.position= c(0.1,0.85)) +
labs(y=" Mean Weight Diameter (mm)") +
  geom_label(aes(label=trimws(.group), y = lsmean+.5),
            label.padding = unit(.3,"lines"), show.legend=NA , label.size = NA, fill=NA, font="bold") +
  guides(fill = guide_legend(override.aes = aes(label="")))

###8-2 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg5$precip <- as.factor(agg5$precip)
x5wsa2000 <- lmer(x5wsa2000 ~ treatment*precip + (1|replication), data=agg5, na.action=na.omit)
anova(x5wsa2000, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF   DenDF F value    Pr(>F)    
## treatment        3046.25 1523.13     2 21.1098  98.376 1.998e-11 ***
## precip            939.68  469.84     2  9.1148  30.346 9.344e-05 ***
## treatment:precip 1637.29  409.32     4 21.1098  26.438 5.896e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x5wsa2000_means_tp <- lsmeans(x5wsa2000, specs = "treatment", by = "precip")

#PWC
x5wsa2000_pwc_tp <- cld(x5wsa2000_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x5wsa2000_pwc_tp <- as.data.frame(x5wsa2000_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x5wsa2000p<- merge(df, x5wsa2000_pwc_tp, by=c("precip")) 

x5wsa2000p$location_f =factor(x5wsa2000p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x5wsa2000p
##   precip  location treatment    lsmean       SE       df  lower.CL  upper.CL
## 1    472   Tribune        EA 10.186894 2.267247 21.87134  5.483308 14.890481
## 2    472   Tribune        NP  8.822787 2.267247 21.87134  4.119200 13.526373
## 3    472   Tribune        AG  6.619284 2.267247 21.87134  1.915697 11.322870
## 4    579      Hays        NP 44.065476 2.267247 21.87134 39.361889 48.769062
## 5    579      Hays        EA 25.901540 2.267247 21.87134 21.197953 30.605126
## 6    579      Hays        AG  1.563937 2.267247 21.87134 -3.139650  6.267523
## 7    850 Manhattan        NP 25.434619 2.267247 21.87134 20.731032 30.138205
## 8    850 Manhattan        EA 14.241278 2.267247 21.87134  9.537691 18.944864
## 9    850 Manhattan        AG  2.857780 2.267247 21.87134 -1.845807  7.561367
##   .group location_f
## 1      a    Tribune
## 2      a    Tribune
## 3      a    Tribune
## 4    a         Hays
## 5     b        Hays
## 6      c       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan

3.1.1 2-0.250 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg5$precip <- as.factor(agg5$precip)
x5wsa250 <- lmer(x5wsa250 ~ treatment*precip + (1|replication), data=agg5, na.action=na.omit)
anova(x5wsa250, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                  Sum Sq Mean Sq NumDF  DenDF F value   Pr(>F)   
## treatment        977.51  488.76     2 21.239  8.4360 0.002012 **
## precip           780.26  390.13     2 10.129  6.7337 0.013802 * 
## treatment:precip 571.64  142.91     4 21.239  2.4666 0.075969 . 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x5wsa250_means_tp <- lsmeans(x5wsa250, specs = "treatment", by = "precip")

#PWC
x5wsa250_pwc_tp <- cld(x5wsa250_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x5wsa250_pwc_tp <- as.data.frame(x5wsa250_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x5wsa250p<- merge(df, x5wsa250_pwc_tp, by=c("precip")) 

x5wsa250p$location_f =factor(x5wsa250p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x5wsa250p
##   precip  location treatment    lsmean       SE       df  lower.CL upper.CL
## 1    472   Tribune        EA 29.018520 3.940058 26.52673 20.927435 37.10960
## 2    472   Tribune        NP 27.005202 3.940058 26.52673 18.914117 35.09629
## 3    472   Tribune        AG  9.931781 3.940058 26.52673  1.840697 18.02287
## 4    579      Hays        NP 32.570016 3.940058 26.52673 24.478931 40.66110
## 5    579      Hays        AG 27.649027 3.940058 26.52673 19.557942 35.74011
## 6    579      Hays        EA 26.595305 3.940058 26.52673 18.504220 34.68639
## 7    850 Manhattan        NP 44.262281 3.940058 26.52673 36.171196 52.35337
## 8    850 Manhattan        EA 31.323713 3.940058 26.52673 23.232629 39.41480
## 9    850 Manhattan        AG 28.049438 3.940058 26.52673 19.958353 36.14052
##   .group location_f
## 1     a     Tribune
## 2     a     Tribune
## 3      b    Tribune
## 4      a       Hays
## 5      a       Hays
## 6      a       Hays
## 7     a   Manhattan
## 8      b  Manhattan
## 9      b  Manhattan

3.1.2 0.250-0.053 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg5$precip <- as.factor(agg5$precip)
x5wsa53 <- lmer(x5wsa53 ~ treatment*precip + (1|replication), data=agg5, na.action=na.omit)
anova(x5wsa53, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                  Sum Sq Mean Sq NumDF  DenDF F value    Pr(>F)    
## treatment        6024.4 3012.22     2 21.639 41.5735 3.872e-08 ***
## precip            112.7   56.36     2 11.231  0.7779    0.4826    
## treatment:precip  356.3   89.08     4 21.639  1.2294    0.3276    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x5wsa53_means_tp <- lsmeans(x5wsa53, specs = "treatment", by = "precip")
x5wsa53_means_tp
## precip = 472:
##  treatment lsmean   SE   df lower.CL upper.CL
##  AG          51.3 4.31 26.9    42.44     60.1
##  EA          35.1 4.31 26.9    26.28     44.0
##  NP          23.4 4.31 26.9    14.57     32.3
## 
## precip = 579:
##  treatment lsmean   SE   df lower.CL upper.CL
##  AG          46.2 4.31 26.9    37.38     55.1
##  EA          39.8 4.31 26.9    30.98     48.7
##  NP          18.9 4.31 26.9    10.08     27.8
## 
## precip = 850:
##  treatment lsmean   SE   df lower.CL upper.CL
##  AG          52.8 4.31 26.9    43.94     61.6
##  EA          30.9 4.31 26.9    22.02     39.7
##  NP          13.0 4.31 26.9     4.11     21.8
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95
#PWC
x5wsa53_pwc_tp <- cld(x5wsa53_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x5wsa53_pwc_tp <- as.data.frame(x5wsa53_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x5wsa53p<- merge(df, x5wsa53_pwc_tp, by=c("precip")) 

x5wsa53p$location_f =factor(x5wsa53p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x5wsa53p
##   precip  location treatment   lsmean       SE       df  lower.CL upper.CL
## 1    472   Tribune        AG 51.28463 4.308961 26.93583 42.442385 60.12687
## 2    472   Tribune        EA 35.12016 4.308961 26.93583 26.277920 43.96241
## 3    472   Tribune        NP 23.41428 4.308961 26.93583 14.572037 32.25652
## 4    579      Hays        AG 46.22015 4.308961 26.93583 37.377911 55.06240
## 5    579      Hays        EA 39.81846 4.308961 26.93583 30.976213 48.66070
## 6    579      Hays        NP 18.92336 4.308961 26.93583 10.081112 27.76560
## 7    850 Manhattan        AG 52.78271 4.308961 26.93583 43.940465 61.62495
## 8    850 Manhattan        EA 30.85960 4.308961 26.93583 22.017359 39.70184
## 9    850 Manhattan        NP 12.95212 4.308961 26.93583  4.109876 21.79436
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4     a        Hays
## 5     a        Hays
## 6      b       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan

3.1.3 0.053-0.02 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg5$precip <- as.factor(agg5$precip)
x5wsa20 <- lmer(x5wsa20 ~ treatment*precip + (1|replication), data=agg5, na.action=na.omit)
anova(x5wsa20, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                  Sum Sq Mean Sq NumDF DenDF F value   Pr(>F)   
## treatment         81.43  40.715     2    27  1.7331 0.195822   
## precip           341.14 170.569     2    27  7.2607 0.002997 **
## treatment:precip 195.51  48.876     4    27  2.0805 0.111180   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x5wsa20_means_tp <- lsmeans(x5wsa20, specs = "treatment", by = "precip")
x5wsa20_means_tp
## precip = 472:
##  treatment lsmean   SE df lower.CL upper.CL
##  AG          6.82 2.42 27  1.85001    11.79
##  EA          4.96 2.42 27 -0.00749     9.94
##  NP          5.25 2.42 27  0.28251    10.23
## 
## precip = 579:
##  treatment lsmean   SE df lower.CL upper.CL
##  AG          6.05 2.42 27  1.08001    11.02
##  EA         16.82 2.42 27 11.84501    21.79
##  NP          8.62 2.42 27  3.64501    13.59
## 
## precip = 850:
##  treatment lsmean   SE df lower.CL upper.CL
##  AG          3.98 2.42 27 -0.99249     8.95
##  EA          3.77 2.42 27 -1.19749     8.75
##  NP          1.43 2.42 27 -3.53853     6.41
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95
#PWC
x5wsa20_pwc_tp <- cld(x5wsa20_means_tp, adjust = "none", Letters = letters, reversed = T)

x5wsa20_pwc_tp
## precip = 472:
##  treatment lsmean   SE df lower.CL upper.CL .group
##  AG          6.82 2.42 27  1.85001    11.79  a    
##  NP          5.25 2.42 27  0.28251    10.23  a    
##  EA          4.96 2.42 27 -0.00749     9.94  a    
## 
## precip = 579:
##  treatment lsmean   SE df lower.CL upper.CL .group
##  EA         16.82 2.42 27 11.84501    21.79  a    
##  NP          8.62 2.42 27  3.64501    13.59   b   
##  AG          6.05 2.42 27  1.08001    11.02   b   
## 
## precip = 850:
##  treatment lsmean   SE df lower.CL upper.CL .group
##  AG          3.98 2.42 27 -0.99249     8.95  a    
##  EA          3.77 2.42 27 -1.19749     8.75  a    
##  NP          1.43 2.42 27 -3.53853     6.41  a    
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95 
## significance level used: alpha = 0.05 
## NOTE: Compact letter displays can be misleading
##       because they show NON-findings rather than findings.
##       Consider using 'pairs()', 'pwpp()', or 'pwpm()' instead.
#transforming it in a data frame to use on ggplot
x5wsa20_pwc_tp <- as.data.frame(x5wsa20_pwc_tp)
x5wsa20_pwc_tp
##   treatment precip    lsmean       SE df     lower.CL  upper.CL .group
## 2        AG    472  6.822500 2.423439 27  1.850013269 11.794987      a
## 3        NP    472  5.255000 2.423439 27  0.282513269 10.227487      a
## 1        EA    472  4.965000 2.423439 27 -0.007486731  9.937487      a
## 4        EA    579 16.817500 2.423439 27 11.845013269 21.789987     a 
## 6        NP    579  8.617500 2.423439 27  3.645013269 13.589987      b
## 5        AG    579  6.052500 2.423439 27  1.080013269 11.024987      b
## 9        AG    850  3.980000 2.423439 27 -0.992486731  8.952487      a
## 8        EA    850  3.775000 2.423439 27 -1.197486731  8.747487      a
## 7        NP    850  1.433954 2.423439 27 -3.538532696  6.406441      a
#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x5wsa20p<- merge(df, x5wsa20_pwc_tp, by=c("precip")) 

x5wsa20p$location_f =factor(x5wsa20p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x5wsa20p
##   precip  location treatment    lsmean       SE df     lower.CL  upper.CL
## 1    472   Tribune        AG  6.822500 2.423439 27  1.850013269 11.794987
## 2    472   Tribune        NP  5.255000 2.423439 27  0.282513269 10.227487
## 3    472   Tribune        EA  4.965000 2.423439 27 -0.007486731  9.937487
## 4    579      Hays        EA 16.817500 2.423439 27 11.845013269 21.789987
## 5    579      Hays        NP  8.617500 2.423439 27  3.645013269 13.589987
## 6    579      Hays        AG  6.052500 2.423439 27  1.080013269 11.024987
## 7    850 Manhattan        AG  3.980000 2.423439 27 -0.992486731  8.952487
## 8    850 Manhattan        EA  3.775000 2.423439 27 -1.197486731  8.747487
## 9    850 Manhattan        NP  1.433954 2.423439 27 -3.538532696  6.406441
##   .group location_f
## 1      a    Tribune
## 2      a    Tribune
## 3      a    Tribune
## 4     a        Hays
## 5      b       Hays
## 6      b       Hays
## 7      a  Manhattan
## 8      a  Manhattan
## 9      a  Manhattan

3.2 5-10 cm 5 minutes

###8-2 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg10$precip <- as.factor(agg10$precip)
x5wsa200010 <- lmer(x5wsa2000 ~ treatment*precip + (1|replication), data=agg10, na.action=na.omit)
anova(x5wsa200010, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                  Sum Sq Mean Sq NumDF  DenDF F value    Pr(>F)    
## treatment        3242.9 1621.44     2 24.816  70.616 5.717e-11 ***
## precip           1202.5  601.27     2 22.710  26.186 1.268e-06 ***
## treatment:precip 2277.5  569.37     4 24.206  24.797 2.946e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x5wsa200010_means_tp <- lsmeans(x5wsa200010, specs = "treatment", by = "precip")

#PWC
x5wsa200010_pwc_tp <- cld(x5wsa200010_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x5wsa200010_pwc_tp <- as.data.frame(x5wsa200010_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x5wsa200010p<- merge(df, x5wsa200010_pwc_tp, by=c("precip")) 

x5wsa200010p$location_f =factor(x5wsa200010p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x5wsa200010p
##   precip  location treatment    lsmean       SE       df  lower.CL  upper.CL
## 1    472   Tribune        NP  7.784108 2.481473 26.41131  2.687230 12.880986
## 2    472   Tribune        AG  7.358129 2.481473 26.41131  2.261251 12.455007
## 3    472   Tribune        EA  3.989024 2.481473 26.41131 -1.107854  9.085902
## 4    579      Hays        NP 47.950775 2.481473 26.41131 42.853897 53.047653
## 5    579      Hays        EA 10.999532 2.481473 26.41131  5.902654 16.096410
## 6    579      Hays        AG  3.551578 2.481473 26.41131 -1.545301  8.648456
## 7    850 Manhattan        NP 27.719093 2.481473 26.41131 22.622215 32.815972
## 8    850 Manhattan        EA 18.601440 2.481473 26.41131 13.504562 23.698318
## 9    850 Manhattan        AG  4.704605 2.481473 26.41131 -0.392273  9.801483
##   .group location_f
## 1      a    Tribune
## 2      a    Tribune
## 3      a    Tribune
## 4    a         Hays
## 5     b        Hays
## 6      c       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan

3.2.1 2-0.250 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg10$precip <- as.factor(agg10$precip)
x5wsa25010 <- lmer(x5wsa250 ~ treatment*precip + (1|replication), data=agg10, na.action=na.omit)
anova(x5wsa25010, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                  Sum Sq Mean Sq NumDF  DenDF F value    Pr(>F)    
## treatment        1308.4  654.22     2 24.405  8.6610 0.0014374 ** 
## precip           1914.2  957.07     2 23.351 12.6703 0.0001878 ***
## treatment:precip 1037.2  259.31     4 23.956  3.4329 0.0235728 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x5wsa25010_means_tp <- lsmeans(x5wsa25010, specs = "treatment", by = "precip")

#PWC
x5wsa25010_pwc_tp <- cld(x5wsa25010_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x5wsa25010_pwc_tp <- as.data.frame(x5wsa25010_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x5wsa25010p<- merge(df, x5wsa25010_pwc_tp, by=c("precip")) 

x5wsa25010p$location_f =factor(x5wsa25010p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x5wsa25010p
##   precip  location treatment   lsmean       SE       df  lower.CL upper.CL
## 1    472   Tribune        NP 36.00030 4.391035 26.94418 26.989762 45.01083
## 2    472   Tribune        EA 17.12701 4.391035 26.94418  8.116474 26.13754
## 3    472   Tribune        AG 15.92634 4.391035 26.94418  6.915812 24.93688
## 4    579      Hays        EA 38.08866 4.391035 26.94418 29.078132 47.09920
## 5    579      Hays        NP 37.44081 4.391035 26.94418 28.430276 46.45134
## 6    579      Hays        AG 16.11014 4.391035 26.94418  7.099607 25.12067
## 7    850 Manhattan        NP 44.20709 4.391035 26.94418 35.196554 53.21762
## 8    850 Manhattan        AG 41.27775 4.391035 26.94418 32.267214 50.28828
## 9    850 Manhattan        EA 37.56607 4.391035 26.94418 28.555534 46.57660
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4     a        Hays
## 5     a        Hays
## 6      b       Hays
## 7      a  Manhattan
## 8      a  Manhattan
## 9      a  Manhattan

3.2.2 0.250-0.053 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg10$precip <- as.factor(agg10$precip)
x5wsa5310 <- lmer(x5wsa53 ~ treatment*precip + (1|replication), data=agg10, na.action=na.omit)
anova(x5wsa5310, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                  Sum Sq Mean Sq NumDF  DenDF F value    Pr(>F)    
## treatment        4653.5 2326.74     2 24.510 27.3284 5.751e-07 ***
## precip           2560.8 1280.39     2 23.660 15.0387 6.102e-05 ***
## treatment:precip  770.2  192.55     4 24.108  2.2616   0.09212 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x5wsa5310_means_tp <- lsmeans(x5wsa5310, specs = "treatment", by = "precip")
x5wsa5310_means_tp
## precip = 472:
##  treatment lsmean   SE df lower.CL upper.CL
##  AG          48.8 4.65 27    39.26     58.3
##  EA          56.3 4.65 27    46.73     65.8
##  NP          28.5 4.65 27    19.01     38.1
## 
## precip = 579:
##  treatment lsmean   SE df lower.CL upper.CL
##  AG          53.8 4.65 27    44.31     63.4
##  EA          52.7 4.65 27    43.21     62.3
##  NP          26.0 4.65 27    16.47     35.5
## 
## precip = 850:
##  treatment lsmean   SE df lower.CL upper.CL
##  AG          42.5 4.65 27    33.01     52.1
##  EA          23.9 4.65 27    14.34     33.4
##  NP          12.8 4.65 27     3.29     22.4
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95
#PWC
x5wsa5310_pwc_tp <- cld(x5wsa5310_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x5wsa5310_pwc_tp <- as.data.frame(x5wsa5310_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x5wsa5310p<- merge(df, x5wsa5310_pwc_tp, by=c("precip")) 

x5wsa5310p$location_f =factor(x5wsa5310p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x5wsa5310p
##   precip  location treatment   lsmean       SE       df  lower.CL upper.CL
## 1    472   Tribune        EA 56.26802 4.646506 26.97369 46.733745 65.80230
## 2    472   Tribune        AG 48.79037 4.646506 26.97369 39.256094 58.32465
## 3    472   Tribune        NP 28.54305 4.646506 26.97369 19.008772 38.07733
## 4    579      Hays        AG 53.84427 4.646506 26.97369 44.309997 63.37855
## 5    579      Hays        EA 52.73937 4.646506 26.97369 43.205095 62.27365
## 6    579      Hays        NP 26.00424 4.646506 26.97369 16.469966 35.53852
## 7    850 Manhattan        AG 42.54411 4.646506 26.97369 33.009834 52.07839
## 8    850 Manhattan        EA 23.87843 4.646506 26.97369 14.344149 33.41270
## 9    850 Manhattan        NP 12.82837 4.646506 26.97369  3.294094 22.36265
##   .group location_f
## 1     a     Tribune
## 2     a     Tribune
## 3      b    Tribune
## 4     a        Hays
## 5     a        Hays
## 6      b       Hays
## 7     a   Manhattan
## 8      b  Manhattan
## 9      b  Manhattan

3.2.3 0.053-0.02 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg10$precip <- as.factor(agg10$precip)
x5wsa2010 <- lmer(x5wsa20 ~ treatment*precip + (1|replication), data=agg10, na.action=na.omit)
anova(x20wsa2010, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                  Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)    
## treatment        79.773  39.886     2    27 22.0949 2.069e-06 ***
## precip            4.560   2.280     2    27  1.2630 0.2989752    
## treatment:precip 55.436  13.859     4    27  7.6771 0.0002882 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x5wsa2010_means_tp <- lsmeans(x5wsa2010, specs = "treatment", by = "precip")

#PWC
x5wsa2010_pwc_tp <- cld(x5wsa2010_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x5wsa2010_pwc_tp <- as.data.frame(x5wsa2010_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x5wsa2010p<- merge(df, x5wsa2010_pwc_tp, by=c("precip")) 

x5wsa2010p$location_f =factor(x5wsa2010p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x5wsa2010p
##   precip  location treatment  lsmean        SE df   lower.CL  upper.CL .group
## 1    472   Tribune        AG  7.5800 0.9417107 27  5.6477693  9.512231      a
## 2    472   Tribune        EA  6.5025 0.9417107 27  4.5702693  8.434731      a
## 3    472   Tribune        NP  4.8950 0.9417107 27  2.9627693  6.827231      a
## 4    579      Hays        EA 11.5525 0.9417107 27  9.6202693 13.484731     a 
## 5    579      Hays        NP  9.0175 0.9417107 27  7.0852693 10.949731     a 
## 6    579      Hays        AG  5.6325 0.9417107 27  3.7002693  7.564731      b
## 7    850 Manhattan        EA  4.2475 0.9417107 27  2.3152693  6.179731      a
## 8    850 Manhattan        AG  2.2525 0.9417107 27  0.3202693  4.184731      a
## 9    850 Manhattan        NP  1.7150 0.9417107 27 -0.2172307  3.647231      a
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan

3.3 10-15 cm 5 minutes

###8-2 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg15$precip <- as.factor(agg15$precip)
x5wsa200015 <- lmer(x5wsa2000 ~ treatment*precip + (1|replication), data=agg15, na.action=na.omit)
anova(x5wsa200015, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)    
## treatment        2795.75 1397.88     2    27 21.7816 2.331e-06 ***
## precip            690.88  345.44     2    27  5.3826   0.01078 *  
## treatment:precip  934.65  233.66     4    27  3.6409   0.01694 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x5wsa200015_means_tp <- lsmeans(x5wsa200015, specs = "treatment", by = "precip")

#PWC
x5wsa200015_pwc_tp <- cld(x5wsa200015_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x5wsa200015_pwc_tp <- as.data.frame(x5wsa200015_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x5wsa200015p<- merge(df, x5wsa200015_pwc_tp, by=c("precip")) 

x5wsa200015p$location_f =factor(x5wsa200015p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x5wsa200015p
##   precip  location treatment    lsmean       SE df   lower.CL upper.CL .group
## 1    472   Tribune        NP 14.583834 4.005528 27  6.3651697 22.80250      a
## 2    472   Tribune        AG  6.606750 4.005528 27 -1.6119142 14.82541      a
## 3    472   Tribune        EA  6.572290 4.005528 27 -1.6463741 14.79095      a
## 4    579      Hays        NP 40.495560 4.005528 27 32.2768962 48.71422     a 
## 5    579      Hays        AG 11.637256 4.005528 27  3.4185919 19.85592      b
## 6    579      Hays        EA  7.687615 4.005528 27 -0.5310489 15.90628      b
## 7    850 Manhattan        NP 26.750084 4.005528 27 18.5314199 34.96875     a 
## 8    850 Manhattan        EA 15.118422 4.005528 27  6.8997576 23.33709     ab
## 9    850 Manhattan        AG  4.467970 4.005528 27 -3.7506942 12.68663      b
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan

3.3.1 2-0.250 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg15$precip <- as.factor(agg15$precip)
x5wsa25015 <- lmer(x5wsa250 ~ treatment*precip + (1|replication), data=agg15, na.action=na.omit)
anova(x5wsa25015, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF DenDF F value   Pr(>F)   
## treatment         473.48  236.74     2    27  1.7764 0.188457   
## precip           2205.73 1102.87     2    27  8.2756 0.001574 **
## treatment:precip 1200.40  300.10     4    27  2.2519 0.089805 . 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x5wsa25015_means_tp <- lsmeans(x5wsa25015, specs = "treatment", by = "precip")

#PWC
x5wsa25015_pwc_tp <- cld(x5wsa25015_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x5wsa25015_pwc_tp <- as.data.frame(x5wsa25015_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x5wsa25015p<- merge(df, x5wsa25015_pwc_tp, by=c("precip")) 

x5wsa25015p$location_f =factor(x5wsa25015p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x5wsa25015p
##   precip  location treatment   lsmean       SE df  lower.CL upper.CL .group
## 1    472   Tribune        EA 32.71524 5.772062 27 20.871950 44.55854      a
## 2    472   Tribune        AG 19.59991 5.772062 27  7.756621 31.44321      a
## 3    472   Tribune        NP 18.03246 5.772062 27  6.189164 29.87575      a
## 4    579      Hays        EA 45.46467 5.772062 27 33.621372 57.30796      a
## 5    579      Hays        NP 32.09403 5.772062 27 20.250733 43.93732      a
## 6    579      Hays        AG 32.00845 5.772062 27 20.165157 43.85174      a
## 7    850 Manhattan        AG 52.68674 5.772062 27 40.843442 64.53003      a
## 8    850 Manhattan        NP 37.69254 5.772062 27 25.849249 49.53584      a
## 9    850 Manhattan        EA 36.01735 5.772062 27 24.174053 47.86064      a
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan

3.3.2 0.250-0.053 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg15$precip <- as.factor(agg15$precip)
x5wsa5315 <- lmer(x5wsa53 ~ treatment*precip + (1|replication), data=agg15, na.action=na.omit)
anova(x5wsa5315, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF DenDF F value  Pr(>F)  
## treatment        1446.44  723.22     2    27  5.3919 0.01071 *
## precip           1385.82  692.91     2    27  5.1660 0.01260 *
## treatment:precip  980.67  245.17     4    27  1.8278 0.15257  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x5wsa5315_means_tp <- lsmeans(x5wsa5315, specs = "treatment", by = "precip")
x5wsa5315_means_tp
## precip = 472:
##  treatment lsmean   SE df lower.CL upper.CL
##  AG          54.1 5.79 27    42.18     65.9
##  EA          41.1 5.79 27    29.22     53.0
##  NP          33.0 5.79 27    21.13     44.9
## 
## precip = 579:
##  treatment lsmean   SE df lower.CL upper.CL
##  AG          32.3 5.79 27    20.39     44.1
##  EA          49.6 5.79 27    37.72     61.5
##  NP          26.4 5.79 27    14.54     38.3
## 
## precip = 850:
##  treatment lsmean   SE df lower.CL upper.CL
##  AG          33.1 5.79 27    21.21     45.0
##  EA          29.5 5.79 27    17.66     41.4
##  NP          20.1 5.79 27     8.18     31.9
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95
#PWC
x5wsa5315_pwc_tp <- cld(x5wsa5315_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
x5wsa5315_pwc_tp <- as.data.frame(x5wsa5315_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x5wsa5315p<- merge(df, x5wsa5315_pwc_tp, by=c("precip")) 

x5wsa5315p$location_f =factor(x5wsa5315p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x5wsa5315p
##   precip  location treatment   lsmean       SE df  lower.CL upper.CL .group
## 1    472   Tribune        AG 54.06194 5.790714 27 42.180374 65.94350     a 
## 2    472   Tribune        EA 41.10064 5.790714 27 29.219080 52.98221     ab
## 3    472   Tribune        NP 33.01473 5.790714 27 21.133171 44.89630      b
## 4    579      Hays        EA 49.59674 5.790714 27 37.715174 61.47830     a 
## 5    579      Hays        AG 32.26746 5.790714 27 20.385893 44.14902      b
## 6    579      Hays        NP 26.41757 5.790714 27 14.536007 38.29913      b
## 7    850 Manhattan        AG 33.09569 5.790714 27 21.214123 44.97725      a
## 8    850 Manhattan        EA 29.54047 5.790714 27 17.658910 41.42204      a
## 9    850 Manhattan        NP 20.06624 5.790714 27  8.184675 31.94780      a
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan

3.3.3 0.053-0.02 mm

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg15$precip <- as.factor(agg15$precip)
x5wsa2015 <- lmer(x5wsa20 ~ treatment*precip + (1|replication), data=agg15, na.action=na.omit)
anova(x5wsa2015, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)    
## treatment         30.440  15.220     2    27  8.3832  0.001472 ** 
## precip           192.516  96.258     2    27 53.0197 4.464e-10 ***
## treatment:precip  37.331   9.333     4    27  5.1406  0.003275 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x5wsa2015_means_tp <- lsmeans(x5wsa2015, specs = "treatment", by = "precip")
x5wsa2015_means_tp
## precip = 472:
##  treatment lsmean    SE df lower.CL upper.CL
##  AG          5.56 0.674 27   4.1752     6.94
##  EA          5.67 0.674 27   4.2927     7.06
##  NP          5.08 0.674 27   3.7027     6.47
## 
## precip = 579:
##  treatment lsmean    SE df lower.CL upper.CL
##  AG          5.85 0.674 27   4.4702     7.23
##  EA         10.87 0.674 27   9.4877    12.25
##  NP          8.93 0.674 27   7.5452    10.31
## 
## precip = 850:
##  treatment lsmean    SE df lower.CL upper.CL
##  AG          3.07 0.674 27   1.6902     4.45
##  EA          4.20 0.674 27   2.8202     5.58
##  NP          1.41 0.674 27   0.0277     2.79
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95
#PWC
x5wsa2015_pwc_tp <- cld(x5wsa2015_means_tp, adjust = "none", Letters = letters, reversed = T)

x5wsa2015_pwc_tp
## precip = 472:
##  treatment lsmean    SE df lower.CL upper.CL .group
##  EA          5.67 0.674 27   4.2927     7.06  a    
##  AG          5.56 0.674 27   4.1752     6.94  a    
##  NP          5.08 0.674 27   3.7027     6.47  a    
## 
## precip = 579:
##  treatment lsmean    SE df lower.CL upper.CL .group
##  EA         10.87 0.674 27   9.4877    12.25  a    
##  NP          8.93 0.674 27   7.5452    10.31  a    
##  AG          5.85 0.674 27   4.4702     7.23   b   
## 
## precip = 850:
##  treatment lsmean    SE df lower.CL upper.CL .group
##  EA          4.20 0.674 27   2.8202     5.58  a    
##  AG          3.07 0.674 27   1.6902     4.45  ab   
##  NP          1.41 0.674 27   0.0277     2.79   b   
## 
## Degrees-of-freedom method: kenward-roger 
## Confidence level used: 0.95 
## significance level used: alpha = 0.05 
## NOTE: Compact letter displays can be misleading
##       because they show NON-findings rather than findings.
##       Consider using 'pairs()', 'pwpp()', or 'pwpm()' instead.
#transforming it in a data frame to use on ggplot
x5wsa2015_pwc_tp <- as.data.frame(x5wsa2015_pwc_tp)
x5wsa2015_pwc_tp
##   treatment precip  lsmean        SE df   lower.CL upper.CL .group
## 3        EA    472  5.6750 0.6737057 27 4.29267004  7.05733      a
## 1        AG    472  5.5575 0.6737057 27 4.17517004  6.93983      a
## 2        NP    472  5.0850 0.6737057 27 3.70267004  6.46733      a
## 4        EA    579 10.8700 0.6737057 27 9.48767004 12.25233     a 
## 6        NP    579  8.9275 0.6737057 27 7.54517004 10.30983     a 
## 5        AG    579  5.8525 0.6737057 27 4.47017004  7.23483      b
## 9        EA    850  4.2025 0.6737057 27 2.82017004  5.58483     a 
## 7        AG    850  3.0725 0.6737057 27 1.69017004  4.45483     ab
## 8        NP    850  1.4100 0.6737057 27 0.02767004  2.79233      b
#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

x5wsa2015p<- merge(df, x5wsa2015_pwc_tp, by=c("precip")) 

x5wsa2015p$location_f =factor(x5wsa2015p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
x5wsa2015p
##   precip  location treatment  lsmean        SE df   lower.CL upper.CL .group
## 1    472   Tribune        EA  5.6750 0.6737057 27 4.29267004  7.05733      a
## 2    472   Tribune        AG  5.5575 0.6737057 27 4.17517004  6.93983      a
## 3    472   Tribune        NP  5.0850 0.6737057 27 3.70267004  6.46733      a
## 4    579      Hays        EA 10.8700 0.6737057 27 9.48767004 12.25233     a 
## 5    579      Hays        NP  8.9275 0.6737057 27 7.54517004 10.30983     a 
## 6    579      Hays        AG  5.8525 0.6737057 27 4.47017004  7.23483      b
## 7    850 Manhattan        EA  4.2025 0.6737057 27 2.82017004  5.58483     a 
## 8    850 Manhattan        AG  3.0725 0.6737057 27 1.69017004  4.45483     ab
## 9    850 Manhattan        NP  1.4100 0.6737057 27 0.02767004  2.79233      b
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan

4 NRCS Aggregate Graphs

4.1 0-5 cm NRCS minutes

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg5$precip <- as.factor(agg5$precip)
nagg <- lmer(nagg ~ treatment*precip + (1|replication), data=agg5, na.action=na.omit)
anova(nagg, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF   DenDF  F value    Pr(>F)    
## treatment        24694.3 12347.2     2 20.3873 291.6684 1.001e-15 ***
## precip             565.5   282.8     2  9.6661   6.6798 0.0150706 *  
## treatment:precip  1324.0   331.0     4 20.3728   7.8188 0.0005496 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
nagg_means_tp <- lsmeans(nagg, specs = "treatment", by = "precip")

#PWC
nagg_pwc_tp <- cld(nagg_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
nagg_pwc_tp <- as.data.frame(nagg_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

naggp<- merge(df, nagg_pwc_tp, by=c("precip")) 

naggp$location_f =factor(naggp$location, levels=c('Tribune', 'Hays', 'Manhattan'))
naggp
##   precip  location treatment    lsmean       SE       df  lower.CL  upper.CL
## 1    472   Tribune        NP 63.965361 3.395653 25.35995 56.976913 70.953809
## 2    472   Tribune        EA 18.059249 3.395653 25.35995 11.070801 25.047697
## 3    472   Tribune        AG  8.551010 3.395653 25.35995  1.562563 15.539458
## 4    579      Hays        NP 79.341536 3.395653 25.35995 72.353089 86.329984
## 5    579      Hays        EA 33.661765 3.395653 25.35995 26.673317 40.650213
## 6    579      Hays        AG  8.396014 3.395653 25.35995  1.407567 15.384462
## 7    850 Manhattan        NP 71.105925 3.395653 25.35995 64.117478 78.094373
## 8    850 Manhattan        EA 45.922074 3.395653 25.35995 38.933627 52.910522
## 9    850 Manhattan        AG  1.474729 3.972346 25.86318 -6.692648  9.642106
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4    a         Hays
## 5     b        Hays
## 6      c       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan

4.2 5-10 cm NRCS minutes

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg10$precip <- as.factor(agg10$precip)
nagg10 <- lmer(nagg ~ treatment*precip + (1|replication), data=agg10, na.action=na.omit)
anova(nagg10, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                   Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)    
## treatment        16061.5  8030.7     2    26 235.869 < 2.2e-16 ***
## precip            1910.3   955.1     2    26  28.053 3.219e-07 ***
## treatment:precip  2078.9   519.7     4    26  15.264 1.521e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
nagg10_means_tp <- lsmeans(nagg10, specs = "treatment", by = "precip")

#PWC
nagg10_pwc_tp <- cld(nagg10_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
nagg10_pwc_tp <- as.data.frame(nagg10_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

nagg10p<- merge(df, nagg10_pwc_tp, by=c("precip")) 

nagg10p$location_f =factor(nagg10p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
nagg10p
##   precip  location treatment    lsmean       SE df   lower.CL  upper.CL .group
## 1    472   Tribune        NP 35.748582 2.917510 26 29.7515545 41.745610     a 
## 2    472   Tribune        AG  5.721995 2.917510 26 -0.2750325 11.719023      b
## 3    472   Tribune        EA  3.686833 2.917510 26 -2.3101946  9.683861      b
## 4    579      Hays        NP 67.060386 2.917510 26 61.0633580 73.057413     a 
## 5    579      Hays        EA  7.599869 2.917510 26  1.6028410 13.596896      b
## 6    579      Hays        AG  6.400527 2.917510 26  0.4034990 12.397554      b
## 7    850 Manhattan        NP 61.784932 2.917510 26 55.7879043 67.781959    a  
## 8    850 Manhattan        EA 32.138297 2.917510 26 26.1412695 38.135325     b 
## 9    850 Manhattan        AG  4.820744 3.452044 26 -2.2750349 11.916522      c
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan

4.3 10-15 cm NRCS minutes

agg5 <- aggr %>%
  filter(bdepth==5)
agg10 <- aggr %>%
  filter(bdepth==10)
agg15 <- aggr %>%
  filter(bdepth==15)

x
## [1] "0-5 cm"
agg15$precip <- as.factor(agg15$precip)
nagg15 <- lmer(nagg ~ treatment*precip + (1|replication), data=agg15, na.action=na.omit)
anova(nagg15, type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                  Sum Sq Mean Sq NumDF  DenDF F value    Pr(>F)    
## treatment        7948.8  3974.4     2 21.897 70.2258  2.98e-10 ***
## precip           2336.6  1168.3     2 11.762 20.6433 0.0001421 ***
## treatment:precip 1452.6   363.1     4 21.897  6.4167 0.0014156 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
nagg15_means_tp <- lsmeans(nagg15, specs = "treatment", by = "precip")

#PWC
nagg15_pwc_tp <- cld(nagg15_means_tp, adjust = "none", Letters = letters, reversed = T)

#transforming it in a data frame to use on ggplot
nagg15_pwc_tp <- as.data.frame(nagg15_pwc_tp)

#add locations
df <- data.frame (location  = c("Tribune", "Hays", "Manhattan"),
                  precip = c("472", "579", "850"))

nagg15p<- merge(df, nagg15_pwc_tp, by=c("precip")) 

nagg15p$location_f =factor(nagg15p$location, levels=c('Tribune', 'Hays', 'Manhattan'))
nagg15p
##   precip  location treatment    lsmean       SE       df   lower.CL upper.CL
## 1    472   Tribune        NP 19.990638 3.794838 26.96694 12.2038258 27.77745
## 2    472   Tribune        EA  4.310915 3.794838 26.96694 -3.4758968 12.09773
## 3    472   Tribune        AG  4.156583 3.794838 26.96694 -3.6302288 11.94339
## 4    579      Hays        NP 51.534489 3.794838 26.96694 43.7476771 59.32130
## 5    579      Hays        AG 17.442633 3.794838 26.96694  9.6558211 25.22944
## 6    579      Hays        EA  7.009381 3.794838 26.96694 -0.7774306 14.79619
## 7    850 Manhattan        NP 54.878590 3.794838 26.96694 47.0917776 62.66540
## 8    850 Manhattan        EA 20.871680 3.794838 26.96694 13.0848680 28.65849
## 9    850 Manhattan        AG  9.891704 3.794838 26.96694  2.1048916 17.67852
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4     a        Hays
## 5      b       Hays
## 6      b       Hays
## 7     a   Manhattan
## 8      b  Manhattan
## 9      b  Manhattan

5 Dataframes

x20wsa2000p
##   precip  location treatment     lsmean       SE df  lower.CL  upper.CL .group
## 1    472   Tribune        NP 26.3313434 3.527336 27 19.093849 33.568838     a 
## 2    472   Tribune        EA  8.8448459 3.527336 27  1.607351 16.082341      b
## 3    472   Tribune        AG  8.7304187 3.527336 27  1.492924 15.967914      b
## 4    579      Hays        NP 30.8387700 3.527336 27 23.601275 38.076265     a 
## 5    579      Hays        EA  9.3305850 3.527336 27  2.093090 16.568080      b
## 6    579      Hays        AG  0.9315208 3.527336 27 -6.305974  8.169016      b
## 7    850 Manhattan        NP 25.3077401 3.527336 27 18.070245 32.545235     a 
## 8    850 Manhattan        EA 11.4886335 3.527336 27  4.251139 18.726128      b
## 9    850 Manhattan        AG  1.9782694 3.527336 27 -5.259225  9.215764      b
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan
x20wsa250p
##   precip  location treatment   lsmean       SE      df  lower.CL upper.CL
## 1    472   Tribune        NP 25.60527 2.634026 25.7468 20.188356 31.02218
## 2    472   Tribune        EA 16.27820 2.634026 25.7468 10.861289 21.69511
## 3    472   Tribune        AG 14.44550 2.634026 25.7468  9.028589 19.86241
## 4    579      Hays        NP 28.53917 2.634026 25.7468 23.122260 33.95608
## 5    579      Hays        EA 22.02193 2.634026 25.7468 16.605020 27.43884
## 6    579      Hays        AG 11.97343 2.634026 25.7468  6.556520 17.39034
## 7    850 Manhattan        NP 37.24528 2.634026 25.7468 31.828368 42.66219
## 8    850 Manhattan        EA 24.97329 2.634026 25.7468 19.556377 30.39020
## 9    850 Manhattan        AG 17.62782 2.634026 25.7468 12.210914 23.04474
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4     a        Hays
## 5     a        Hays
## 6      b       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan
x20wsa53p
##   precip  location treatment   lsmean       SE       df  lower.CL upper.CL
## 1    472   Tribune        AG 53.07399 3.736594 22.78911 45.340296 60.80768
## 2    472   Tribune        EA 49.13078 3.736594 22.78911 41.397089 56.86447
## 3    472   Tribune        NP 22.29726 3.736594 22.78911 14.563572 30.03096
## 4    579      Hays        AG 69.79728 3.736594 22.78911 62.063591 77.53098
## 5    579      Hays        EA 47.93665 3.736594 22.78911 40.202952 55.67034
## 6    579      Hays        NP 14.90930 3.736594 22.78911  7.175602 22.64299
## 7    850 Manhattan        AG 61.16504 3.736594 22.78911 53.431345 68.89873
## 8    850 Manhattan        EA 47.38140 3.736594 22.78911 39.647708 55.11509
## 9    850 Manhattan        NP 16.56350 3.736594 22.78911  8.829805 24.29719
##   .group location_f
## 1     a     Tribune
## 2     a     Tribune
## 3      b    Tribune
## 4    a         Hays
## 5     b        Hays
## 6      c       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan
x20wsa20p
##   precip  location treatment lsmean        SE df   lower.CL upper.CL .group
## 1    472   Tribune        AG 6.1575 0.7752837 27  4.5667492 7.748251     a 
## 2    472   Tribune        EA 3.9900 0.7752837 27  2.3992492 5.580751     ab
## 3    472   Tribune        NP 1.9500 0.7752837 27  0.3592492 3.540751      b
## 4    579      Hays        AG 5.2825 0.7752837 27  3.6917492 6.873251     a 
## 5    579      Hays        EA 3.3750 0.7752837 27  1.7842492 4.965751     a 
## 6    579      Hays        NP 1.0475 0.7752837 27 -0.5432508 2.638251      b
## 7    850 Manhattan        AG 7.2450 0.7752837 27  5.6542492 8.835751     a 
## 8    850 Manhattan        EA 5.1450 0.7752837 27  3.5542492 6.735751     a 
## 9    850 Manhattan        NP 1.9325 0.7752837 27  0.3417492 3.523251      b
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan
x20wsa200010p
##   precip  location treatment    lsmean       SE df    lower.CL  upper.CL .group
## 1    472   Tribune        NP 19.874634 2.079862 27 15.60710952 24.142159     a 
## 2    472   Tribune        AG  7.158672 2.079862 27  2.89114749 11.426197      b
## 3    472   Tribune        EA  2.303734 2.079862 27 -1.96379035  6.571259      b
## 4    579      Hays        NP 27.933098 2.079862 27 23.66557284 32.200622     a 
## 5    579      Hays        EA  4.312530 2.079862 27  0.04500509  8.580054      b
## 6    579      Hays        AG  1.369402 2.079862 27 -2.89812306  5.636926      b
## 7    850 Manhattan        NP 19.539639 2.079862 27 15.27211447 23.807164     a 
## 8    850 Manhattan        EA  8.197339 2.079862 27  3.92981461 12.464864      b
## 9    850 Manhattan        AG  3.003322 2.079862 27 -1.26420295  7.270846      b
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan
x20wsa25010p
##   precip  location treatment   lsmean       SE       df  lower.CL upper.CL
## 1    472   Tribune        NP 33.76226 4.905017 26.37839 23.686887 43.83763
## 2    472   Tribune        AG 31.38025 4.905017 26.37839 21.304875 41.45562
## 3    472   Tribune        EA 15.88541 4.905017 26.37839  5.810033 25.96078
## 4    579      Hays        EA 29.76832 4.905017 26.37839 19.692944 39.84369
## 5    579      Hays        NP 22.88141 4.905017 26.37839 12.806039 32.95679
## 6    579      Hays        AG 12.44605 4.905017 26.37839  2.370679 22.52143
## 7    850 Manhattan        NP 35.21192 4.905017 26.37839 25.136550 45.28730
## 8    850 Manhattan        EA 31.98805 4.905017 26.37839 21.912672 42.06342
## 9    850 Manhattan        AG 19.00936 4.905017 26.37839  8.933983 29.08473
##   .group location_f
## 1     a     Tribune
## 2     a     Tribune
## 3      b    Tribune
## 4     a        Hays
## 5     ab       Hays
## 6      b       Hays
## 7     a   Manhattan
## 8     ab  Manhattan
## 9      b  Manhattan
x20wsa5310p
##   precip  location treatment   lsmean       SE       df lower.CL upper.CL
## 1    472   Tribune        EA 60.53863 4.905302 20.96793 50.33654 70.74071
## 2    472   Tribune        AG 40.25275 4.905302 20.96793 30.05067 50.45484
## 3    472   Tribune        NP 24.33689 4.905302 20.96793 14.13481 34.53898
## 4    579      Hays        AG 61.04155 4.905302 20.96793 50.83947 71.24364
## 5    579      Hays        EA 47.54742 4.905302 20.96793 37.34533 57.74950
## 6    579      Hays        NP 28.36159 4.905302 20.96793 18.15950 38.56367
## 7    850 Manhattan        AG 60.48042 4.905302 20.96793 50.27834 70.68251
## 8    850 Manhattan        EA 45.04338 4.905302 20.96793 34.84130 55.24547
## 9    850 Manhattan        NP 23.59988 4.905302 20.96793 13.39779 33.80196
##   .group location_f
## 1    a      Tribune
## 2     b     Tribune
## 3      c    Tribune
## 4    a         Hays
## 5     b        Hays
## 6      c       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan
x20wsa2010p
##   precip  location treatment lsmean       SE df  lower.CL upper.CL .group
## 1    472   Tribune        EA 5.4100 0.671795 27 4.0315905  6.78841     a 
## 2    472   Tribune        AG 4.1075 0.671795 27 2.7290905  5.48591     ab
## 3    472   Tribune        NP 2.1825 0.671795 27 0.8040905  3.56091      b
## 4    579      Hays        AG 8.7775 0.671795 27 7.3990905 10.15591    a  
## 5    579      Hays        EA 3.7775 0.671795 27 2.3990905  5.15591     b 
## 6    579      Hays        NP 1.7575 0.671795 27 0.3790905  3.13591      c
## 7    850 Manhattan        EA 5.0475 0.671795 27 3.6690905  6.42591     a 
## 8    850 Manhattan        AG 4.8125 0.671795 27 3.4340905  6.19091     ab
## 9    850 Manhattan        NP 3.0400 0.671795 27 1.6615905  4.41841      b
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan
x20wsa200015p
##   precip  location treatment    lsmean       SE df   lower.CL  upper.CL .group
## 1    472   Tribune        NP 26.297002 1.901863 27 22.3947003 30.199303     a 
## 2    472   Tribune        AG  7.344079 1.901863 27  3.4417780 11.246381      b
## 3    472   Tribune        EA  3.058975 1.901863 27 -0.8433266  6.961276      b
## 4    579      Hays        NP 23.871558 1.901863 27 19.9692562 27.773859     a 
## 5    579      Hays        EA  2.561610 1.901863 27 -1.3406916  6.463911      b
## 6    579      Hays        AG  1.931631 1.901863 27 -1.9706708  5.833932      b
## 7    850 Manhattan        NP 25.368150 1.901863 27 21.4658488 29.270451     a 
## 8    850 Manhattan        EA  4.378598 1.901863 27  0.4762962  8.280899      b
## 9    850 Manhattan        AG  2.653159 1.901863 27 -1.2491423  6.555460      b
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan
x20wsa25015p
##   precip  location treatment   lsmean       SE       df  lower.CL upper.CL
## 1    472   Tribune        NP 31.52114 5.299915 24.42448 20.592709 42.44958
## 2    472   Tribune        AG 27.33366 5.299915 24.42448 16.405226 38.26210
## 3    472   Tribune        EA 15.88228 5.299915 24.42448  4.953841 26.81071
## 4    579      Hays        AG 32.94085 5.299915 24.42448 22.012414 43.86929
## 5    579      Hays        NP 23.26334 5.299915 24.42448 12.334906 34.19178
## 6    579      Hays        EA 18.86667 5.299915 24.42448  7.938236 29.79511
## 7    850 Manhattan        NP 37.56309 5.299915 24.42448 26.634649 48.49152
## 8    850 Manhattan        AG 29.49422 5.299915 24.42448 18.565782 40.42265
## 9    850 Manhattan        EA 25.79500 5.299915 24.42448 14.866564 36.72344
##   .group location_f
## 1     a     Tribune
## 2     ab    Tribune
## 3      b    Tribune
## 4      a       Hays
## 5      a       Hays
## 6      a       Hays
## 7      a  Manhattan
## 8      a  Manhattan
## 9      a  Manhattan
x20wsa5315p
##   precip  location treatment   lsmean       SE      df  lower.CL upper.CL
## 1    472   Tribune        EA 51.12957 5.586198 26.3469 39.654327 62.60481
## 2    472   Tribune        AG 43.85542 5.586198 26.3469 32.380181 55.33066
## 3    472   Tribune        NP 20.87374 5.586198 26.3469  9.398503 32.34898
## 4    579      Hays        EA 59.98533 5.586198 26.3469 48.510085 71.46056
## 5    579      Hays        AG 44.03529 5.586198 26.3469 32.560046 55.51053
## 6    579      Hays        NP 32.68928 5.586198 26.3469 21.214043 44.16452
## 7    850 Manhattan        AG 54.04183 5.586198 26.3469 42.566587 65.51707
## 8    850 Manhattan        EA 52.36527 5.586198 26.3469 40.890028 63.84051
## 9    850 Manhattan        NP 19.45423 5.586198 26.3469  7.978991 30.92947
##   .group location_f
## 1     a     Tribune
## 2     a     Tribune
## 3      b    Tribune
## 4     a        Hays
## 5      b       Hays
## 6      b       Hays
## 7     a   Manhattan
## 8     a   Manhattan
## 9      b  Manhattan
x20wsa2015p
##   precip  location treatment lsmean       SE       df   lower.CL  upper.CL
## 1    472   Tribune        EA 8.4225 1.094354 22.58634  6.1563605 10.688639
## 2    472   Tribune        AG 4.4125 1.094354 22.58634  2.1463605  6.678639
## 3    472   Tribune        NP 1.6150 1.094354 22.58634 -0.6511395  3.881139
## 4    579      Hays        AG 7.8275 1.094354 22.58634  5.5613605 10.093639
## 5    579      Hays        EA 5.5625 1.094354 22.58634  3.2963605  7.828639
## 6    579      Hays        NP 2.4400 1.094354 22.58634  0.1738605  4.706139
## 7    850 Manhattan        EA 6.9400 1.094354 22.58634  4.6738605  9.206139
## 8    850 Manhattan        AG 3.4700 1.094354 22.58634  1.2038605  5.736139
## 9    850 Manhattan        NP 1.7325 1.094354 22.58634 -0.5336395  3.998639
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4     a        Hays
## 5     a        Hays
## 6      b       Hays
## 7     a   Manhattan
## 8      b  Manhattan
## 9      b  Manhattan
x5wsa2000p
##   precip  location treatment    lsmean       SE       df  lower.CL  upper.CL
## 1    472   Tribune        EA 10.186894 2.267247 21.87134  5.483308 14.890481
## 2    472   Tribune        NP  8.822787 2.267247 21.87134  4.119200 13.526373
## 3    472   Tribune        AG  6.619284 2.267247 21.87134  1.915697 11.322870
## 4    579      Hays        NP 44.065476 2.267247 21.87134 39.361889 48.769062
## 5    579      Hays        EA 25.901540 2.267247 21.87134 21.197953 30.605126
## 6    579      Hays        AG  1.563937 2.267247 21.87134 -3.139650  6.267523
## 7    850 Manhattan        NP 25.434619 2.267247 21.87134 20.731032 30.138205
## 8    850 Manhattan        EA 14.241278 2.267247 21.87134  9.537691 18.944864
## 9    850 Manhattan        AG  2.857780 2.267247 21.87134 -1.845807  7.561367
##   .group location_f
## 1      a    Tribune
## 2      a    Tribune
## 3      a    Tribune
## 4    a         Hays
## 5     b        Hays
## 6      c       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan
x5wsa250p
##   precip  location treatment    lsmean       SE       df  lower.CL upper.CL
## 1    472   Tribune        EA 29.018520 3.940058 26.52673 20.927435 37.10960
## 2    472   Tribune        NP 27.005202 3.940058 26.52673 18.914117 35.09629
## 3    472   Tribune        AG  9.931781 3.940058 26.52673  1.840697 18.02287
## 4    579      Hays        NP 32.570016 3.940058 26.52673 24.478931 40.66110
## 5    579      Hays        AG 27.649027 3.940058 26.52673 19.557942 35.74011
## 6    579      Hays        EA 26.595305 3.940058 26.52673 18.504220 34.68639
## 7    850 Manhattan        NP 44.262281 3.940058 26.52673 36.171196 52.35337
## 8    850 Manhattan        EA 31.323713 3.940058 26.52673 23.232629 39.41480
## 9    850 Manhattan        AG 28.049438 3.940058 26.52673 19.958353 36.14052
##   .group location_f
## 1     a     Tribune
## 2     a     Tribune
## 3      b    Tribune
## 4      a       Hays
## 5      a       Hays
## 6      a       Hays
## 7     a   Manhattan
## 8      b  Manhattan
## 9      b  Manhattan
x5wsa53p
##   precip  location treatment   lsmean       SE       df  lower.CL upper.CL
## 1    472   Tribune        AG 51.28463 4.308961 26.93583 42.442385 60.12687
## 2    472   Tribune        EA 35.12016 4.308961 26.93583 26.277920 43.96241
## 3    472   Tribune        NP 23.41428 4.308961 26.93583 14.572037 32.25652
## 4    579      Hays        AG 46.22015 4.308961 26.93583 37.377911 55.06240
## 5    579      Hays        EA 39.81846 4.308961 26.93583 30.976213 48.66070
## 6    579      Hays        NP 18.92336 4.308961 26.93583 10.081112 27.76560
## 7    850 Manhattan        AG 52.78271 4.308961 26.93583 43.940465 61.62495
## 8    850 Manhattan        EA 30.85960 4.308961 26.93583 22.017359 39.70184
## 9    850 Manhattan        NP 12.95212 4.308961 26.93583  4.109876 21.79436
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4     a        Hays
## 5     a        Hays
## 6      b       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan
x5wsa20p
##   precip  location treatment    lsmean       SE df     lower.CL  upper.CL
## 1    472   Tribune        AG  6.822500 2.423439 27  1.850013269 11.794987
## 2    472   Tribune        NP  5.255000 2.423439 27  0.282513269 10.227487
## 3    472   Tribune        EA  4.965000 2.423439 27 -0.007486731  9.937487
## 4    579      Hays        EA 16.817500 2.423439 27 11.845013269 21.789987
## 5    579      Hays        NP  8.617500 2.423439 27  3.645013269 13.589987
## 6    579      Hays        AG  6.052500 2.423439 27  1.080013269 11.024987
## 7    850 Manhattan        AG  3.980000 2.423439 27 -0.992486731  8.952487
## 8    850 Manhattan        EA  3.775000 2.423439 27 -1.197486731  8.747487
## 9    850 Manhattan        NP  1.433954 2.423439 27 -3.538532696  6.406441
##   .group location_f
## 1      a    Tribune
## 2      a    Tribune
## 3      a    Tribune
## 4     a        Hays
## 5      b       Hays
## 6      b       Hays
## 7      a  Manhattan
## 8      a  Manhattan
## 9      a  Manhattan
x5wsa200010p
##   precip  location treatment    lsmean       SE       df  lower.CL  upper.CL
## 1    472   Tribune        NP  7.784108 2.481473 26.41131  2.687230 12.880986
## 2    472   Tribune        AG  7.358129 2.481473 26.41131  2.261251 12.455007
## 3    472   Tribune        EA  3.989024 2.481473 26.41131 -1.107854  9.085902
## 4    579      Hays        NP 47.950775 2.481473 26.41131 42.853897 53.047653
## 5    579      Hays        EA 10.999532 2.481473 26.41131  5.902654 16.096410
## 6    579      Hays        AG  3.551578 2.481473 26.41131 -1.545301  8.648456
## 7    850 Manhattan        NP 27.719093 2.481473 26.41131 22.622215 32.815972
## 8    850 Manhattan        EA 18.601440 2.481473 26.41131 13.504562 23.698318
## 9    850 Manhattan        AG  4.704605 2.481473 26.41131 -0.392273  9.801483
##   .group location_f
## 1      a    Tribune
## 2      a    Tribune
## 3      a    Tribune
## 4    a         Hays
## 5     b        Hays
## 6      c       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan
x5wsa25010p
##   precip  location treatment   lsmean       SE       df  lower.CL upper.CL
## 1    472   Tribune        NP 36.00030 4.391035 26.94418 26.989762 45.01083
## 2    472   Tribune        EA 17.12701 4.391035 26.94418  8.116474 26.13754
## 3    472   Tribune        AG 15.92634 4.391035 26.94418  6.915812 24.93688
## 4    579      Hays        EA 38.08866 4.391035 26.94418 29.078132 47.09920
## 5    579      Hays        NP 37.44081 4.391035 26.94418 28.430276 46.45134
## 6    579      Hays        AG 16.11014 4.391035 26.94418  7.099607 25.12067
## 7    850 Manhattan        NP 44.20709 4.391035 26.94418 35.196554 53.21762
## 8    850 Manhattan        AG 41.27775 4.391035 26.94418 32.267214 50.28828
## 9    850 Manhattan        EA 37.56607 4.391035 26.94418 28.555534 46.57660
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4     a        Hays
## 5     a        Hays
## 6      b       Hays
## 7      a  Manhattan
## 8      a  Manhattan
## 9      a  Manhattan
x5wsa5310p
##   precip  location treatment   lsmean       SE       df  lower.CL upper.CL
## 1    472   Tribune        EA 56.26802 4.646506 26.97369 46.733745 65.80230
## 2    472   Tribune        AG 48.79037 4.646506 26.97369 39.256094 58.32465
## 3    472   Tribune        NP 28.54305 4.646506 26.97369 19.008772 38.07733
## 4    579      Hays        AG 53.84427 4.646506 26.97369 44.309997 63.37855
## 5    579      Hays        EA 52.73937 4.646506 26.97369 43.205095 62.27365
## 6    579      Hays        NP 26.00424 4.646506 26.97369 16.469966 35.53852
## 7    850 Manhattan        AG 42.54411 4.646506 26.97369 33.009834 52.07839
## 8    850 Manhattan        EA 23.87843 4.646506 26.97369 14.344149 33.41270
## 9    850 Manhattan        NP 12.82837 4.646506 26.97369  3.294094 22.36265
##   .group location_f
## 1     a     Tribune
## 2     a     Tribune
## 3      b    Tribune
## 4     a        Hays
## 5     a        Hays
## 6      b       Hays
## 7     a   Manhattan
## 8      b  Manhattan
## 9      b  Manhattan
x5wsa2010p
##   precip  location treatment  lsmean        SE df   lower.CL  upper.CL .group
## 1    472   Tribune        AG  7.5800 0.9417107 27  5.6477693  9.512231      a
## 2    472   Tribune        EA  6.5025 0.9417107 27  4.5702693  8.434731      a
## 3    472   Tribune        NP  4.8950 0.9417107 27  2.9627693  6.827231      a
## 4    579      Hays        EA 11.5525 0.9417107 27  9.6202693 13.484731     a 
## 5    579      Hays        NP  9.0175 0.9417107 27  7.0852693 10.949731     a 
## 6    579      Hays        AG  5.6325 0.9417107 27  3.7002693  7.564731      b
## 7    850 Manhattan        EA  4.2475 0.9417107 27  2.3152693  6.179731      a
## 8    850 Manhattan        AG  2.2525 0.9417107 27  0.3202693  4.184731      a
## 9    850 Manhattan        NP  1.7150 0.9417107 27 -0.2172307  3.647231      a
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan
x5wsa200015p
##   precip  location treatment    lsmean       SE df   lower.CL upper.CL .group
## 1    472   Tribune        NP 14.583834 4.005528 27  6.3651697 22.80250      a
## 2    472   Tribune        AG  6.606750 4.005528 27 -1.6119142 14.82541      a
## 3    472   Tribune        EA  6.572290 4.005528 27 -1.6463741 14.79095      a
## 4    579      Hays        NP 40.495560 4.005528 27 32.2768962 48.71422     a 
## 5    579      Hays        AG 11.637256 4.005528 27  3.4185919 19.85592      b
## 6    579      Hays        EA  7.687615 4.005528 27 -0.5310489 15.90628      b
## 7    850 Manhattan        NP 26.750084 4.005528 27 18.5314199 34.96875     a 
## 8    850 Manhattan        EA 15.118422 4.005528 27  6.8997576 23.33709     ab
## 9    850 Manhattan        AG  4.467970 4.005528 27 -3.7506942 12.68663      b
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan
x5wsa25015p
##   precip  location treatment   lsmean       SE df  lower.CL upper.CL .group
## 1    472   Tribune        EA 32.71524 5.772062 27 20.871950 44.55854      a
## 2    472   Tribune        AG 19.59991 5.772062 27  7.756621 31.44321      a
## 3    472   Tribune        NP 18.03246 5.772062 27  6.189164 29.87575      a
## 4    579      Hays        EA 45.46467 5.772062 27 33.621372 57.30796      a
## 5    579      Hays        NP 32.09403 5.772062 27 20.250733 43.93732      a
## 6    579      Hays        AG 32.00845 5.772062 27 20.165157 43.85174      a
## 7    850 Manhattan        AG 52.68674 5.772062 27 40.843442 64.53003      a
## 8    850 Manhattan        NP 37.69254 5.772062 27 25.849249 49.53584      a
## 9    850 Manhattan        EA 36.01735 5.772062 27 24.174053 47.86064      a
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan
x5wsa5315p
##   precip  location treatment   lsmean       SE df  lower.CL upper.CL .group
## 1    472   Tribune        AG 54.06194 5.790714 27 42.180374 65.94350     a 
## 2    472   Tribune        EA 41.10064 5.790714 27 29.219080 52.98221     ab
## 3    472   Tribune        NP 33.01473 5.790714 27 21.133171 44.89630      b
## 4    579      Hays        EA 49.59674 5.790714 27 37.715174 61.47830     a 
## 5    579      Hays        AG 32.26746 5.790714 27 20.385893 44.14902      b
## 6    579      Hays        NP 26.41757 5.790714 27 14.536007 38.29913      b
## 7    850 Manhattan        AG 33.09569 5.790714 27 21.214123 44.97725      a
## 8    850 Manhattan        EA 29.54047 5.790714 27 17.658910 41.42204      a
## 9    850 Manhattan        NP 20.06624 5.790714 27  8.184675 31.94780      a
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan
x5wsa2015p
##   precip  location treatment  lsmean        SE df   lower.CL upper.CL .group
## 1    472   Tribune        EA  5.6750 0.6737057 27 4.29267004  7.05733      a
## 2    472   Tribune        AG  5.5575 0.6737057 27 4.17517004  6.93983      a
## 3    472   Tribune        NP  5.0850 0.6737057 27 3.70267004  6.46733      a
## 4    579      Hays        EA 10.8700 0.6737057 27 9.48767004 12.25233     a 
## 5    579      Hays        NP  8.9275 0.6737057 27 7.54517004 10.30983     a 
## 6    579      Hays        AG  5.8525 0.6737057 27 4.47017004  7.23483      b
## 7    850 Manhattan        EA  4.2025 0.6737057 27 2.82017004  5.58483     a 
## 8    850 Manhattan        AG  3.0725 0.6737057 27 1.69017004  4.45483     ab
## 9    850 Manhattan        NP  1.4100 0.6737057 27 0.02767004  2.79233      b
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan
naggp
##   precip  location treatment    lsmean       SE       df  lower.CL  upper.CL
## 1    472   Tribune        NP 63.965361 3.395653 25.35995 56.976913 70.953809
## 2    472   Tribune        EA 18.059249 3.395653 25.35995 11.070801 25.047697
## 3    472   Tribune        AG  8.551010 3.395653 25.35995  1.562563 15.539458
## 4    579      Hays        NP 79.341536 3.395653 25.35995 72.353089 86.329984
## 5    579      Hays        EA 33.661765 3.395653 25.35995 26.673317 40.650213
## 6    579      Hays        AG  8.396014 3.395653 25.35995  1.407567 15.384462
## 7    850 Manhattan        NP 71.105925 3.395653 25.35995 64.117478 78.094373
## 8    850 Manhattan        EA 45.922074 3.395653 25.35995 38.933627 52.910522
## 9    850 Manhattan        AG  1.474729 3.972346 25.86318 -6.692648  9.642106
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4    a         Hays
## 5     b        Hays
## 6      c       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan
nagg10p
##   precip  location treatment    lsmean       SE df   lower.CL  upper.CL .group
## 1    472   Tribune        NP 35.748582 2.917510 26 29.7515545 41.745610     a 
## 2    472   Tribune        AG  5.721995 2.917510 26 -0.2750325 11.719023      b
## 3    472   Tribune        EA  3.686833 2.917510 26 -2.3101946  9.683861      b
## 4    579      Hays        NP 67.060386 2.917510 26 61.0633580 73.057413     a 
## 5    579      Hays        EA  7.599869 2.917510 26  1.6028410 13.596896      b
## 6    579      Hays        AG  6.400527 2.917510 26  0.4034990 12.397554      b
## 7    850 Manhattan        NP 61.784932 2.917510 26 55.7879043 67.781959    a  
## 8    850 Manhattan        EA 32.138297 2.917510 26 26.1412695 38.135325     b 
## 9    850 Manhattan        AG  4.820744 3.452044 26 -2.2750349 11.916522      c
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan
nagg15p
##   precip  location treatment    lsmean       SE       df   lower.CL upper.CL
## 1    472   Tribune        NP 19.990638 3.794838 26.96694 12.2038258 27.77745
## 2    472   Tribune        EA  4.310915 3.794838 26.96694 -3.4758968 12.09773
## 3    472   Tribune        AG  4.156583 3.794838 26.96694 -3.6302288 11.94339
## 4    579      Hays        NP 51.534489 3.794838 26.96694 43.7476771 59.32130
## 5    579      Hays        AG 17.442633 3.794838 26.96694  9.6558211 25.22944
## 6    579      Hays        EA  7.009381 3.794838 26.96694 -0.7774306 14.79619
## 7    850 Manhattan        NP 54.878590 3.794838 26.96694 47.0917776 62.66540
## 8    850 Manhattan        EA 20.871680 3.794838 26.96694 13.0848680 28.65849
## 9    850 Manhattan        AG  9.891704 3.794838 26.96694  2.1048916 17.67852
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4     a        Hays
## 5      b       Hays
## 6      b       Hays
## 7     a   Manhattan
## 8      b  Manhattan
## 9      b  Manhattan

6 Adding location x to data frame

#8-2 gets 0.7, 1, 1.3 for AG, EA, NP

df8_2 <- data.frame (treatment  = c("AG", "EA", "NP"),
                  xloc = c(".7", "1", "1.3"))
x20wsa2000p <- merge(x20wsa2000p, df8_2, by=c("treatment"))
x20wsa2000p
##   treatment precip  location     lsmean       SE df  lower.CL  upper.CL .group
## 1        AG    579      Hays  0.9315208 3.527336 27 -6.305974  8.169016      b
## 2        AG    472   Tribune  8.7304187 3.527336 27  1.492924 15.967914      b
## 3        AG    850 Manhattan  1.9782694 3.527336 27 -5.259225  9.215764      b
## 4        EA    472   Tribune  8.8448459 3.527336 27  1.607351 16.082341      b
## 5        EA    579      Hays  9.3305850 3.527336 27  2.093090 16.568080      b
## 6        EA    850 Manhattan 11.4886335 3.527336 27  4.251139 18.726128      b
## 7        NP    472   Tribune 26.3313434 3.527336 27 19.093849 33.568838     a 
## 8        NP    850 Manhattan 25.3077401 3.527336 27 18.070245 32.545235     a 
## 9        NP    579      Hays 30.8387700 3.527336 27 23.601275 38.076265     a 
##   location_f xloc
## 1       Hays   .7
## 2    Tribune   .7
## 3  Manhattan   .7
## 4    Tribune    1
## 5       Hays    1
## 6  Manhattan    1
## 7    Tribune  1.3
## 8  Manhattan  1.3
## 9       Hays  1.3
x20wsa200010p<- merge(x20wsa200010p, df8_2, by=c("treatment"))
x20wsa200010p
##   treatment precip  location    lsmean       SE df    lower.CL  upper.CL .group
## 1        AG    472   Tribune  7.158672 2.079862 27  2.89114749 11.426197      b
## 2        AG    850 Manhattan  3.003322 2.079862 27 -1.26420295  7.270846      b
## 3        AG    579      Hays  1.369402 2.079862 27 -2.89812306  5.636926      b
## 4        EA    472   Tribune  2.303734 2.079862 27 -1.96379035  6.571259      b
## 5        EA    850 Manhattan  8.197339 2.079862 27  3.92981461 12.464864      b
## 6        EA    579      Hays  4.312530 2.079862 27  0.04500509  8.580054      b
## 7        NP    472   Tribune 19.874634 2.079862 27 15.60710952 24.142159     a 
## 8        NP    850 Manhattan 19.539639 2.079862 27 15.27211447 23.807164     a 
## 9        NP    579      Hays 27.933098 2.079862 27 23.66557284 32.200622     a 
##   location_f xloc
## 1    Tribune   .7
## 2  Manhattan   .7
## 3       Hays   .7
## 4    Tribune    1
## 5  Manhattan    1
## 6       Hays    1
## 7    Tribune  1.3
## 8  Manhattan  1.3
## 9       Hays  1.3
x20wsa200015p<- merge(x20wsa200015p, df8_2, by=c("treatment"))
x20wsa200015p
##   treatment precip  location    lsmean       SE df   lower.CL  upper.CL .group
## 1        AG    472   Tribune  7.344079 1.901863 27  3.4417780 11.246381      b
## 2        AG    850 Manhattan  2.653159 1.901863 27 -1.2491423  6.555460      b
## 3        AG    579      Hays  1.931631 1.901863 27 -1.9706708  5.833932      b
## 4        EA    472   Tribune  3.058975 1.901863 27 -0.8433266  6.961276      b
## 5        EA    850 Manhattan  4.378598 1.901863 27  0.4762962  8.280899      b
## 6        EA    579      Hays  2.561610 1.901863 27 -1.3406916  6.463911      b
## 7        NP    472   Tribune 26.297002 1.901863 27 22.3947003 30.199303     a 
## 8        NP    850 Manhattan 25.368150 1.901863 27 21.4658488 29.270451     a 
## 9        NP    579      Hays 23.871558 1.901863 27 19.9692562 27.773859     a 
##   location_f xloc
## 1    Tribune   .7
## 2  Manhattan   .7
## 3       Hays   .7
## 4    Tribune    1
## 5  Manhattan    1
## 6       Hays    1
## 7    Tribune  1.3
## 8  Manhattan  1.3
## 9       Hays  1.3
x5wsa2000p<- merge(x5wsa2000p, df8_2, by=c("treatment"))
x5wsa2000p
##   treatment precip  location    lsmean       SE       df  lower.CL  upper.CL
## 1        AG    579      Hays  1.563937 2.267247 21.87134 -3.139650  6.267523
## 2        AG    472   Tribune  6.619284 2.267247 21.87134  1.915697 11.322870
## 3        AG    850 Manhattan  2.857780 2.267247 21.87134 -1.845807  7.561367
## 4        EA    472   Tribune 10.186894 2.267247 21.87134  5.483308 14.890481
## 5        EA    850 Manhattan 14.241278 2.267247 21.87134  9.537691 18.944864
## 6        EA    579      Hays 25.901540 2.267247 21.87134 21.197953 30.605126
## 7        NP    472   Tribune  8.822787 2.267247 21.87134  4.119200 13.526373
## 8        NP    850 Manhattan 25.434619 2.267247 21.87134 20.731032 30.138205
## 9        NP    579      Hays 44.065476 2.267247 21.87134 39.361889 48.769062
##   .group location_f xloc
## 1      c       Hays   .7
## 2      a    Tribune   .7
## 3      c  Manhattan   .7
## 4      a    Tribune    1
## 5     b   Manhattan    1
## 6     b        Hays    1
## 7      a    Tribune  1.3
## 8    a    Manhattan  1.3
## 9    a         Hays  1.3
x5wsa200010p<- merge(x5wsa200010p, df8_2, by=c("treatment"))
x5wsa200010p
##   treatment precip  location    lsmean       SE       df  lower.CL  upper.CL
## 1        AG    472   Tribune  7.358129 2.481473 26.41131  2.261251 12.455007
## 2        AG    850 Manhattan  4.704605 2.481473 26.41131 -0.392273  9.801483
## 3        AG    579      Hays  3.551578 2.481473 26.41131 -1.545301  8.648456
## 4        EA    472   Tribune  3.989024 2.481473 26.41131 -1.107854  9.085902
## 5        EA    850 Manhattan 18.601440 2.481473 26.41131 13.504562 23.698318
## 6        EA    579      Hays 10.999532 2.481473 26.41131  5.902654 16.096410
## 7        NP    472   Tribune  7.784108 2.481473 26.41131  2.687230 12.880986
## 8        NP    850 Manhattan 27.719093 2.481473 26.41131 22.622215 32.815972
## 9        NP    579      Hays 47.950775 2.481473 26.41131 42.853897 53.047653
##   .group location_f xloc
## 1      a    Tribune   .7
## 2      c  Manhattan   .7
## 3      c       Hays   .7
## 4      a    Tribune    1
## 5     b   Manhattan    1
## 6     b        Hays    1
## 7      a    Tribune  1.3
## 8    a    Manhattan  1.3
## 9    a         Hays  1.3
x5wsa200015p<- merge(x5wsa200015p, df8_2, by=c("treatment"))
x5wsa200015p
##   treatment precip  location    lsmean       SE df   lower.CL upper.CL .group
## 1        AG    472   Tribune  6.606750 4.005528 27 -1.6119142 14.82541      a
## 2        AG    579      Hays 11.637256 4.005528 27  3.4185919 19.85592      b
## 3        AG    850 Manhattan  4.467970 4.005528 27 -3.7506942 12.68663      b
## 4        EA    579      Hays  7.687615 4.005528 27 -0.5310489 15.90628      b
## 5        EA    472   Tribune  6.572290 4.005528 27 -1.6463741 14.79095      a
## 6        EA    850 Manhattan 15.118422 4.005528 27  6.8997576 23.33709     ab
## 7        NP    472   Tribune 14.583834 4.005528 27  6.3651697 22.80250      a
## 8        NP    850 Manhattan 26.750084 4.005528 27 18.5314199 34.96875     a 
## 9        NP    579      Hays 40.495560 4.005528 27 32.2768962 48.71422     a 
##   location_f xloc
## 1    Tribune   .7
## 2       Hays   .7
## 3  Manhattan   .7
## 4       Hays    1
## 5    Tribune    1
## 6  Manhattan    1
## 7    Tribune  1.3
## 8  Manhattan  1.3
## 9       Hays  1.3
#2-0.25 gets 1.7, 2, 2.3 for AG, EA, NP

df2_025 <- data.frame (treatment  = c("AG", "EA", "NP"),
                  xloc = c("1.7", "2", "2.3"))

x20wsa250p<- merge(x20wsa250p, df2_025, by=c("treatment"))
x20wsa250p
##   treatment precip  location   lsmean       SE      df  lower.CL upper.CL
## 1        AG    579      Hays 11.97343 2.634026 25.7468  6.556520 17.39034
## 2        AG    472   Tribune 14.44550 2.634026 25.7468  9.028589 19.86241
## 3        AG    850 Manhattan 17.62782 2.634026 25.7468 12.210914 23.04474
## 4        EA    472   Tribune 16.27820 2.634026 25.7468 10.861289 21.69511
## 5        EA    579      Hays 22.02193 2.634026 25.7468 16.605020 27.43884
## 6        EA    850 Manhattan 24.97329 2.634026 25.7468 19.556377 30.39020
## 7        NP    472   Tribune 25.60527 2.634026 25.7468 20.188356 31.02218
## 8        NP    850 Manhattan 37.24528 2.634026 25.7468 31.828368 42.66219
## 9        NP    579      Hays 28.53917 2.634026 25.7468 23.122260 33.95608
##   .group location_f xloc
## 1      b       Hays  1.7
## 2      b    Tribune  1.7
## 3      c  Manhattan  1.7
## 4      b    Tribune    2
## 5     a        Hays    2
## 6     b   Manhattan    2
## 7     a     Tribune  2.3
## 8    a    Manhattan  2.3
## 9     a        Hays  2.3
x20wsa25010p<- merge(x20wsa25010p, df2_025, by=c("treatment"))
x20wsa25010p
##   treatment precip  location   lsmean       SE       df  lower.CL upper.CL
## 1        AG    472   Tribune 31.38025 4.905017 26.37839 21.304875 41.45562
## 2        AG    579      Hays 12.44605 4.905017 26.37839  2.370679 22.52143
## 3        AG    850 Manhattan 19.00936 4.905017 26.37839  8.933983 29.08473
## 4        EA    579      Hays 29.76832 4.905017 26.37839 19.692944 39.84369
## 5        EA    472   Tribune 15.88541 4.905017 26.37839  5.810033 25.96078
## 6        EA    850 Manhattan 31.98805 4.905017 26.37839 21.912672 42.06342
## 7        NP    472   Tribune 33.76226 4.905017 26.37839 23.686887 43.83763
## 8        NP    850 Manhattan 35.21192 4.905017 26.37839 25.136550 45.28730
## 9        NP    579      Hays 22.88141 4.905017 26.37839 12.806039 32.95679
##   .group location_f xloc
## 1     a     Tribune  1.7
## 2      b       Hays  1.7
## 3      b  Manhattan  1.7
## 4     a        Hays    2
## 5      b    Tribune    2
## 6     ab  Manhattan    2
## 7     a     Tribune  2.3
## 8     a   Manhattan  2.3
## 9     ab       Hays  2.3
x20wsa25015p<- merge(x20wsa25015p, df2_025, by=c("treatment"))
x20wsa25015p
##   treatment precip  location   lsmean       SE       df  lower.CL upper.CL
## 1        AG    472   Tribune 27.33366 5.299915 24.42448 16.405226 38.26210
## 2        AG    579      Hays 32.94085 5.299915 24.42448 22.012414 43.86929
## 3        AG    850 Manhattan 29.49422 5.299915 24.42448 18.565782 40.42265
## 4        EA    579      Hays 18.86667 5.299915 24.42448  7.938236 29.79511
## 5        EA    472   Tribune 15.88228 5.299915 24.42448  4.953841 26.81071
## 6        EA    850 Manhattan 25.79500 5.299915 24.42448 14.866564 36.72344
## 7        NP    472   Tribune 31.52114 5.299915 24.42448 20.592709 42.44958
## 8        NP    850 Manhattan 37.56309 5.299915 24.42448 26.634649 48.49152
## 9        NP    579      Hays 23.26334 5.299915 24.42448 12.334906 34.19178
##   .group location_f xloc
## 1     ab    Tribune  1.7
## 2      a       Hays  1.7
## 3      a  Manhattan  1.7
## 4      a       Hays    2
## 5      b    Tribune    2
## 6      a  Manhattan    2
## 7     a     Tribune  2.3
## 8      a  Manhattan  2.3
## 9      a       Hays  2.3
x5wsa250p<- merge(x5wsa250p, df2_025, by=c("treatment"))
x5wsa250p
##   treatment precip  location    lsmean       SE       df  lower.CL upper.CL
## 1        AG    579      Hays 27.649027 3.940058 26.52673 19.557942 35.74011
## 2        AG    472   Tribune  9.931781 3.940058 26.52673  1.840697 18.02287
## 3        AG    850 Manhattan 28.049438 3.940058 26.52673 19.958353 36.14052
## 4        EA    472   Tribune 29.018520 3.940058 26.52673 20.927435 37.10960
## 5        EA    579      Hays 26.595305 3.940058 26.52673 18.504220 34.68639
## 6        EA    850 Manhattan 31.323713 3.940058 26.52673 23.232629 39.41480
## 7        NP    850 Manhattan 44.262281 3.940058 26.52673 36.171196 52.35337
## 8        NP    472   Tribune 27.005202 3.940058 26.52673 18.914117 35.09629
## 9        NP    579      Hays 32.570016 3.940058 26.52673 24.478931 40.66110
##   .group location_f xloc
## 1      a       Hays  1.7
## 2      b    Tribune  1.7
## 3      b  Manhattan  1.7
## 4     a     Tribune    2
## 5      a       Hays    2
## 6      b  Manhattan    2
## 7     a   Manhattan  2.3
## 8     a     Tribune  2.3
## 9      a       Hays  2.3
x5wsa25010p<- merge(x5wsa25010p, df2_025, by=c("treatment"))
x5wsa25010p
##   treatment precip  location   lsmean       SE       df  lower.CL upper.CL
## 1        AG    579      Hays 16.11014 4.391035 26.94418  7.099607 25.12067
## 2        AG    472   Tribune 15.92634 4.391035 26.94418  6.915812 24.93688
## 3        AG    850 Manhattan 41.27775 4.391035 26.94418 32.267214 50.28828
## 4        EA    472   Tribune 17.12701 4.391035 26.94418  8.116474 26.13754
## 5        EA    579      Hays 38.08866 4.391035 26.94418 29.078132 47.09920
## 6        EA    850 Manhattan 37.56607 4.391035 26.94418 28.555534 46.57660
## 7        NP    472   Tribune 36.00030 4.391035 26.94418 26.989762 45.01083
## 8        NP    850 Manhattan 44.20709 4.391035 26.94418 35.196554 53.21762
## 9        NP    579      Hays 37.44081 4.391035 26.94418 28.430276 46.45134
##   .group location_f xloc
## 1      b       Hays  1.7
## 2      b    Tribune  1.7
## 3      a  Manhattan  1.7
## 4      b    Tribune    2
## 5     a        Hays    2
## 6      a  Manhattan    2
## 7     a     Tribune  2.3
## 8      a  Manhattan  2.3
## 9     a        Hays  2.3
x5wsa25015p<- merge(x5wsa25015p, df2_025, by=c("treatment"))
x5wsa25015p
##   treatment precip  location   lsmean       SE df  lower.CL upper.CL .group
## 1        AG    472   Tribune 19.59991 5.772062 27  7.756621 31.44321      a
## 2        AG    850 Manhattan 52.68674 5.772062 27 40.843442 64.53003      a
## 3        AG    579      Hays 32.00845 5.772062 27 20.165157 43.85174      a
## 4        EA    472   Tribune 32.71524 5.772062 27 20.871950 44.55854      a
## 5        EA    579      Hays 45.46467 5.772062 27 33.621372 57.30796      a
## 6        EA    850 Manhattan 36.01735 5.772062 27 24.174053 47.86064      a
## 7        NP    472   Tribune 18.03246 5.772062 27  6.189164 29.87575      a
## 8        NP    850 Manhattan 37.69254 5.772062 27 25.849249 49.53584      a
## 9        NP    579      Hays 32.09403 5.772062 27 20.250733 43.93732      a
##   location_f xloc
## 1    Tribune  1.7
## 2  Manhattan  1.7
## 3       Hays  1.7
## 4    Tribune    2
## 5       Hays    2
## 6  Manhattan    2
## 7    Tribune  2.3
## 8  Manhattan  2.3
## 9       Hays  2.3
#0.25-0.053 gets 2.7, 3, 3.3 for AG, EA, NP

df025_053 <- data.frame (treatment  = c("AG", "EA", "NP"),
                  xloc = c("2.7", "3", "3.3"))

x20wsa53p<- merge(x20wsa53p, df025_053, by=c("treatment"))
x20wsa53p
##   treatment precip  location   lsmean       SE       df  lower.CL upper.CL
## 1        AG    472   Tribune 53.07399 3.736594 22.78911 45.340296 60.80768
## 2        AG    850 Manhattan 61.16504 3.736594 22.78911 53.431345 68.89873
## 3        AG    579      Hays 69.79728 3.736594 22.78911 62.063591 77.53098
## 4        EA    472   Tribune 49.13078 3.736594 22.78911 41.397089 56.86447
## 5        EA    579      Hays 47.93665 3.736594 22.78911 40.202952 55.67034
## 6        EA    850 Manhattan 47.38140 3.736594 22.78911 39.647708 55.11509
## 7        NP    579      Hays 14.90930 3.736594 22.78911  7.175602 22.64299
## 8        NP    472   Tribune 22.29726 3.736594 22.78911 14.563572 30.03096
## 9        NP    850 Manhattan 16.56350 3.736594 22.78911  8.829805 24.29719
##   .group location_f xloc
## 1     a     Tribune  2.7
## 2    a    Manhattan  2.7
## 3    a         Hays  2.7
## 4     a     Tribune    3
## 5     b        Hays    3
## 6     b   Manhattan    3
## 7      c       Hays  3.3
## 8      b    Tribune  3.3
## 9      c  Manhattan  3.3
x20wsa5310p<- merge(x20wsa5310p, df025_053, by=c("treatment"))
x20wsa5310p
##   treatment precip  location   lsmean       SE       df lower.CL upper.CL
## 1        AG    472   Tribune 40.25275 4.905302 20.96793 30.05067 50.45484
## 2        AG    850 Manhattan 60.48042 4.905302 20.96793 50.27834 70.68251
## 3        AG    579      Hays 61.04155 4.905302 20.96793 50.83947 71.24364
## 4        EA    472   Tribune 60.53863 4.905302 20.96793 50.33654 70.74071
## 5        EA    850 Manhattan 45.04338 4.905302 20.96793 34.84130 55.24547
## 6        EA    579      Hays 47.54742 4.905302 20.96793 37.34533 57.74950
## 7        NP    579      Hays 28.36159 4.905302 20.96793 18.15950 38.56367
## 8        NP    472   Tribune 24.33689 4.905302 20.96793 14.13481 34.53898
## 9        NP    850 Manhattan 23.59988 4.905302 20.96793 13.39779 33.80196
##   .group location_f xloc
## 1     b     Tribune  2.7
## 2    a    Manhattan  2.7
## 3    a         Hays  2.7
## 4    a      Tribune    3
## 5     b   Manhattan    3
## 6     b        Hays    3
## 7      c       Hays  3.3
## 8      c    Tribune  3.3
## 9      c  Manhattan  3.3
x20wsa5315p<- merge(x20wsa5315p, df025_053, by=c("treatment"))
x20wsa5315p
##   treatment precip  location   lsmean       SE      df  lower.CL upper.CL
## 1        AG    472   Tribune 43.85542 5.586198 26.3469 32.380181 55.33066
## 2        AG    850 Manhattan 54.04183 5.586198 26.3469 42.566587 65.51707
## 3        AG    579      Hays 44.03529 5.586198 26.3469 32.560046 55.51053
## 4        EA    472   Tribune 51.12957 5.586198 26.3469 39.654327 62.60481
## 5        EA    579      Hays 59.98533 5.586198 26.3469 48.510085 71.46056
## 6        EA    850 Manhattan 52.36527 5.586198 26.3469 40.890028 63.84051
## 7        NP    579      Hays 32.68928 5.586198 26.3469 21.214043 44.16452
## 8        NP    472   Tribune 20.87374 5.586198 26.3469  9.398503 32.34898
## 9        NP    850 Manhattan 19.45423 5.586198 26.3469  7.978991 30.92947
##   .group location_f xloc
## 1     a     Tribune  2.7
## 2     a   Manhattan  2.7
## 3      b       Hays  2.7
## 4     a     Tribune    3
## 5     a        Hays    3
## 6     a   Manhattan    3
## 7      b       Hays  3.3
## 8      b    Tribune  3.3
## 9      b  Manhattan  3.3
x5wsa53p<- merge(x5wsa53p, df025_053, by=c("treatment"))
x5wsa53p
##   treatment precip  location   lsmean       SE       df  lower.CL upper.CL
## 1        AG    472   Tribune 51.28463 4.308961 26.93583 42.442385 60.12687
## 2        AG    850 Manhattan 52.78271 4.308961 26.93583 43.940465 61.62495
## 3        AG    579      Hays 46.22015 4.308961 26.93583 37.377911 55.06240
## 4        EA    472   Tribune 35.12016 4.308961 26.93583 26.277920 43.96241
## 5        EA    579      Hays 39.81846 4.308961 26.93583 30.976213 48.66070
## 6        EA    850 Manhattan 30.85960 4.308961 26.93583 22.017359 39.70184
## 7        NP    579      Hays 18.92336 4.308961 26.93583 10.081112 27.76560
## 8        NP    472   Tribune 23.41428 4.308961 26.93583 14.572037 32.25652
## 9        NP    850 Manhattan 12.95212 4.308961 26.93583  4.109876 21.79436
##   .group location_f xloc
## 1     a     Tribune  2.7
## 2    a    Manhattan  2.7
## 3     a        Hays  2.7
## 4      b    Tribune    3
## 5     a        Hays    3
## 6     b   Manhattan    3
## 7      b       Hays  3.3
## 8      b    Tribune  3.3
## 9      c  Manhattan  3.3
x5wsa5310p<- merge(x5wsa5310p, df025_053, by=c("treatment"))
x5wsa5310p
##   treatment precip  location   lsmean       SE       df  lower.CL upper.CL
## 1        AG    472   Tribune 48.79037 4.646506 26.97369 39.256094 58.32465
## 2        AG    850 Manhattan 42.54411 4.646506 26.97369 33.009834 52.07839
## 3        AG    579      Hays 53.84427 4.646506 26.97369 44.309997 63.37855
## 4        EA    472   Tribune 56.26802 4.646506 26.97369 46.733745 65.80230
## 5        EA    850 Manhattan 23.87843 4.646506 26.97369 14.344149 33.41270
## 6        EA    579      Hays 52.73937 4.646506 26.97369 43.205095 62.27365
## 7        NP    579      Hays 26.00424 4.646506 26.97369 16.469966 35.53852
## 8        NP    472   Tribune 28.54305 4.646506 26.97369 19.008772 38.07733
## 9        NP    850 Manhattan 12.82837 4.646506 26.97369  3.294094 22.36265
##   .group location_f xloc
## 1     a     Tribune  2.7
## 2     a   Manhattan  2.7
## 3     a        Hays  2.7
## 4     a     Tribune    3
## 5      b  Manhattan    3
## 6     a        Hays    3
## 7      b       Hays  3.3
## 8      b    Tribune  3.3
## 9      b  Manhattan  3.3
x5wsa5315p<- merge(x5wsa5315p, df025_053, by=c("treatment"))
x5wsa5315p
##   treatment precip  location   lsmean       SE df  lower.CL upper.CL .group
## 1        AG    472   Tribune 54.06194 5.790714 27 42.180374 65.94350     a 
## 2        AG    850 Manhattan 33.09569 5.790714 27 21.214123 44.97725      a
## 3        AG    579      Hays 32.26746 5.790714 27 20.385893 44.14902      b
## 4        EA    472   Tribune 41.10064 5.790714 27 29.219080 52.98221     ab
## 5        EA    579      Hays 49.59674 5.790714 27 37.715174 61.47830     a 
## 6        EA    850 Manhattan 29.54047 5.790714 27 17.658910 41.42204      a
## 7        NP    579      Hays 26.41757 5.790714 27 14.536007 38.29913      b
## 8        NP    472   Tribune 33.01473 5.790714 27 21.133171 44.89630      b
## 9        NP    850 Manhattan 20.06624 5.790714 27  8.184675 31.94780      a
##   location_f xloc
## 1    Tribune  2.7
## 2  Manhattan  2.7
## 3       Hays  2.7
## 4    Tribune    3
## 5       Hays    3
## 6  Manhattan    3
## 7       Hays  3.3
## 8    Tribune  3.3
## 9  Manhattan  3.3
#0.053-0.02 gets 3.7, 4, 4.3 for AG, EA, NP

df053_02 <- data.frame (treatment  = c("AG", "EA", "NP"),
                  xloc = c("3.7", "4", "4.3"))

x20wsa20p<- merge(x20wsa20p, df053_02, by=c("treatment"))
x20wsa20p
##   treatment precip  location lsmean        SE df   lower.CL upper.CL .group
## 1        AG    472   Tribune 6.1575 0.7752837 27  4.5667492 7.748251     a 
## 2        AG    850 Manhattan 7.2450 0.7752837 27  5.6542492 8.835751     a 
## 3        AG    579      Hays 5.2825 0.7752837 27  3.6917492 6.873251     a 
## 4        EA    472   Tribune 3.9900 0.7752837 27  2.3992492 5.580751     ab
## 5        EA    579      Hays 3.3750 0.7752837 27  1.7842492 4.965751     a 
## 6        EA    850 Manhattan 5.1450 0.7752837 27  3.5542492 6.735751     a 
## 7        NP    579      Hays 1.0475 0.7752837 27 -0.5432508 2.638251      b
## 8        NP    472   Tribune 1.9500 0.7752837 27  0.3592492 3.540751      b
## 9        NP    850 Manhattan 1.9325 0.7752837 27  0.3417492 3.523251      b
##   location_f xloc
## 1    Tribune  3.7
## 2  Manhattan  3.7
## 3       Hays  3.7
## 4    Tribune    4
## 5       Hays    4
## 6  Manhattan    4
## 7       Hays  4.3
## 8    Tribune  4.3
## 9  Manhattan  4.3
x20wsa2010p<- merge(x20wsa2010p, df053_02, by=c("treatment"))
x20wsa2010p
##   treatment precip  location lsmean       SE df  lower.CL upper.CL .group
## 1        AG    472   Tribune 4.1075 0.671795 27 2.7290905  5.48591     ab
## 2        AG    579      Hays 8.7775 0.671795 27 7.3990905 10.15591    a  
## 3        AG    850 Manhattan 4.8125 0.671795 27 3.4340905  6.19091     ab
## 4        EA    472   Tribune 5.4100 0.671795 27 4.0315905  6.78841     a 
## 5        EA    850 Manhattan 5.0475 0.671795 27 3.6690905  6.42591     a 
## 6        EA    579      Hays 3.7775 0.671795 27 2.3990905  5.15591     b 
## 7        NP    579      Hays 1.7575 0.671795 27 0.3790905  3.13591      c
## 8        NP    472   Tribune 2.1825 0.671795 27 0.8040905  3.56091      b
## 9        NP    850 Manhattan 3.0400 0.671795 27 1.6615905  4.41841      b
##   location_f xloc
## 1    Tribune  3.7
## 2       Hays  3.7
## 3  Manhattan  3.7
## 4    Tribune    4
## 5  Manhattan    4
## 6       Hays    4
## 7       Hays  4.3
## 8    Tribune  4.3
## 9  Manhattan  4.3
x20wsa2015p<- merge(x20wsa2015p, df053_02, by=c("treatment"))
x20wsa2015p
##   treatment precip  location lsmean       SE       df   lower.CL  upper.CL
## 1        AG    472   Tribune 4.4125 1.094354 22.58634  2.1463605  6.678639
## 2        AG    579      Hays 7.8275 1.094354 22.58634  5.5613605 10.093639
## 3        AG    850 Manhattan 3.4700 1.094354 22.58634  1.2038605  5.736139
## 4        EA    472   Tribune 8.4225 1.094354 22.58634  6.1563605 10.688639
## 5        EA    850 Manhattan 6.9400 1.094354 22.58634  4.6738605  9.206139
## 6        EA    579      Hays 5.5625 1.094354 22.58634  3.2963605  7.828639
## 7        NP    579      Hays 2.4400 1.094354 22.58634  0.1738605  4.706139
## 8        NP    472   Tribune 1.6150 1.094354 22.58634 -0.6511395  3.881139
## 9        NP    850 Manhattan 1.7325 1.094354 22.58634 -0.5336395  3.998639
##   .group location_f xloc
## 1      b    Tribune  3.7
## 2     a        Hays  3.7
## 3      b  Manhattan  3.7
## 4     a     Tribune    4
## 5     a   Manhattan    4
## 6     a        Hays    4
## 7      b       Hays  4.3
## 8      b    Tribune  4.3
## 9      b  Manhattan  4.3
x5wsa20p<- merge(x5wsa20p, df053_02, by=c("treatment"))
x5wsa20p
##   treatment precip  location    lsmean       SE df     lower.CL  upper.CL
## 1        AG    472   Tribune  6.822500 2.423439 27  1.850013269 11.794987
## 2        AG    579      Hays  6.052500 2.423439 27  1.080013269 11.024987
## 3        AG    850 Manhattan  3.980000 2.423439 27 -0.992486731  8.952487
## 4        EA    579      Hays 16.817500 2.423439 27 11.845013269 21.789987
## 5        EA    472   Tribune  4.965000 2.423439 27 -0.007486731  9.937487
## 6        EA    850 Manhattan  3.775000 2.423439 27 -1.197486731  8.747487
## 7        NP    579      Hays  8.617500 2.423439 27  3.645013269 13.589987
## 8        NP    472   Tribune  5.255000 2.423439 27  0.282513269 10.227487
## 9        NP    850 Manhattan  1.433954 2.423439 27 -3.538532696  6.406441
##   .group location_f xloc
## 1      a    Tribune  3.7
## 2      b       Hays  3.7
## 3      a  Manhattan  3.7
## 4     a        Hays    4
## 5      a    Tribune    4
## 6      a  Manhattan    4
## 7      b       Hays  4.3
## 8      a    Tribune  4.3
## 9      a  Manhattan  4.3
x5wsa2010p<- merge(x5wsa2010p, df053_02, by=c("treatment"))
x5wsa2010p
##   treatment precip  location  lsmean        SE df   lower.CL  upper.CL .group
## 1        AG    472   Tribune  7.5800 0.9417107 27  5.6477693  9.512231      a
## 2        AG    579      Hays  5.6325 0.9417107 27  3.7002693  7.564731      b
## 3        AG    850 Manhattan  2.2525 0.9417107 27  0.3202693  4.184731      a
## 4        EA    850 Manhattan  4.2475 0.9417107 27  2.3152693  6.179731      a
## 5        EA    472   Tribune  6.5025 0.9417107 27  4.5702693  8.434731      a
## 6        EA    579      Hays 11.5525 0.9417107 27  9.6202693 13.484731     a 
## 7        NP    579      Hays  9.0175 0.9417107 27  7.0852693 10.949731     a 
## 8        NP    472   Tribune  4.8950 0.9417107 27  2.9627693  6.827231      a
## 9        NP    850 Manhattan  1.7150 0.9417107 27 -0.2172307  3.647231      a
##   location_f xloc
## 1    Tribune  3.7
## 2       Hays  3.7
## 3  Manhattan  3.7
## 4  Manhattan    4
## 5    Tribune    4
## 6       Hays    4
## 7       Hays  4.3
## 8    Tribune  4.3
## 9  Manhattan  4.3
x5wsa2015p<- merge(x5wsa2015p, df053_02, by=c("treatment"))
x5wsa2015p
##   treatment precip  location  lsmean        SE df   lower.CL upper.CL .group
## 1        AG    472   Tribune  5.5575 0.6737057 27 4.17517004  6.93983      a
## 2        AG    579      Hays  5.8525 0.6737057 27 4.47017004  7.23483      b
## 3        AG    850 Manhattan  3.0725 0.6737057 27 1.69017004  4.45483     ab
## 4        EA    472   Tribune  5.6750 0.6737057 27 4.29267004  7.05733      a
## 5        EA    850 Manhattan  4.2025 0.6737057 27 2.82017004  5.58483     a 
## 6        EA    579      Hays 10.8700 0.6737057 27 9.48767004 12.25233     a 
## 7        NP    579      Hays  8.9275 0.6737057 27 7.54517004 10.30983     a 
## 8        NP    472   Tribune  5.0850 0.6737057 27 3.70267004  6.46733      a
## 9        NP    850 Manhattan  1.4100 0.6737057 27 0.02767004  2.79233      b
##   location_f xloc
## 1    Tribune  3.7
## 2       Hays  3.7
## 3  Manhattan  3.7
## 4    Tribune    4
## 5  Manhattan    4
## 6       Hays    4
## 7       Hays  4.3
## 8    Tribune  4.3
## 9  Manhattan  4.3

7 Converted Dataframes

x20wsa2000vec <- rep(c("8-2"),9)
x20wsa250vec <- rep(c("2-0.25"),9)
x20wsa53vec <- rep(c("0.25-0.053"),9)
x20wsa20vec <- rep(c("0.053-0.020"),9)

x5wsa2000vec <- rep(c("8-2"),9)
x5wsa250vec <- rep(c("2-0.25"),9)
x5wsa53vec <- rep(c("0.25-0.053"),9)
x5wsa20vec <- rep(c("0.053-0.020"),9)

#20 minutes 0-5 cm

x20x20005 <- x20wsa2000p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x20wsa2000vec) 

x20x2505 <- x20wsa250p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x20wsa250vec)

x20x535 <- x20wsa53p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x20wsa53vec)

x20x205 <- x20wsa20p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x20wsa20vec)

#rbind

x20minx5 <- rbind(x20x20005,x20x2505,x20x535,x20x205)

x20minx5
##    precip  location treatment     lsmean .group xloc aggregate_size
## 1     579      Hays        AG  0.9315208      b   .7            8-2
## 2     472   Tribune        AG  8.7304187      b   .7            8-2
## 3     850 Manhattan        AG  1.9782694      b   .7            8-2
## 4     472   Tribune        EA  8.8448459      b    1            8-2
## 5     579      Hays        EA  9.3305850      b    1            8-2
## 6     850 Manhattan        EA 11.4886335      b    1            8-2
## 7     472   Tribune        NP 26.3313434     a   1.3            8-2
## 8     850 Manhattan        NP 25.3077401     a   1.3            8-2
## 9     579      Hays        NP 30.8387700     a   1.3            8-2
## 10    579      Hays        AG 11.9734301      b  1.7         2-0.25
## 11    472   Tribune        AG 14.4454999      b  1.7         2-0.25
## 12    850 Manhattan        AG 17.6278247      c  1.7         2-0.25
## 13    472   Tribune        EA 16.2781993      b    2         2-0.25
## 14    579      Hays        EA 22.0219300     a     2         2-0.25
## 15    850 Manhattan        EA 24.9732871     b     2         2-0.25
## 16    472   Tribune        NP 25.6052664     a   2.3         2-0.25
## 17    850 Manhattan        NP 37.2452781    a    2.3         2-0.25
## 18    579      Hays        NP 28.5391700     a   2.3         2-0.25
## 19    472   Tribune        AG 53.0739889     a   2.7     0.25-0.053
## 20    850 Manhattan        AG 61.1650379    a    2.7     0.25-0.053
## 21    579      Hays        AG 69.7972833    a    2.7     0.25-0.053
## 22    472   Tribune        EA 49.1307814     a     3     0.25-0.053
## 23    579      Hays        EA 47.9366450     b     3     0.25-0.053
## 24    850 Manhattan        EA 47.3814008     b     3     0.25-0.053
## 25    579      Hays        NP 14.9092950      c  3.3     0.25-0.053
## 26    472   Tribune        NP 22.2972642      b  3.3     0.25-0.053
## 27    850 Manhattan        NP 16.5634973      c  3.3     0.25-0.053
## 28    472   Tribune        AG  6.1575000     a   3.7    0.053-0.020
## 29    850 Manhattan        AG  7.2450000     a   3.7    0.053-0.020
## 30    579      Hays        AG  5.2825000     a   3.7    0.053-0.020
## 31    472   Tribune        EA  3.9900000     ab    4    0.053-0.020
## 32    579      Hays        EA  3.3750000     a     4    0.053-0.020
## 33    850 Manhattan        EA  5.1450000     a     4    0.053-0.020
## 34    579      Hays        NP  1.0475000      b  4.3    0.053-0.020
## 35    472   Tribune        NP  1.9500000      b  4.3    0.053-0.020
## 36    850 Manhattan        NP  1.9325000      b  4.3    0.053-0.020
###########20 minutes 5-10 cm

x20x200010 <- x20wsa200010p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x20wsa2000vec)

x20x25010 <- x20wsa25010p  %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x20wsa250vec)

x20x5310 <- x20wsa5310p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x20wsa53vec)

x20x2010 <- x20wsa2010p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x20wsa20vec)

#rbind

x20minx10 <- rbind(x20x200010,x20x25010,x20x5310,x20x2010)

x20minx10
##    precip  location treatment    lsmean .group xloc aggregate_size
## 1     472   Tribune        AG  7.158672      b   .7            8-2
## 2     850 Manhattan        AG  3.003322      b   .7            8-2
## 3     579      Hays        AG  1.369402      b   .7            8-2
## 4     472   Tribune        EA  2.303734      b    1            8-2
## 5     850 Manhattan        EA  8.197339      b    1            8-2
## 6     579      Hays        EA  4.312530      b    1            8-2
## 7     472   Tribune        NP 19.874634     a   1.3            8-2
## 8     850 Manhattan        NP 19.539639     a   1.3            8-2
## 9     579      Hays        NP 27.933098     a   1.3            8-2
## 10    472   Tribune        AG 31.380248     a   1.7         2-0.25
## 11    579      Hays        AG 12.446052      b  1.7         2-0.25
## 12    850 Manhattan        AG 19.009357      b  1.7         2-0.25
## 13    579      Hays        EA 29.768317     a     2         2-0.25
## 14    472   Tribune        EA 15.885406      b    2         2-0.25
## 15    850 Manhattan        EA 31.988045     ab    2         2-0.25
## 16    472   Tribune        NP 33.762260     a   2.3         2-0.25
## 17    850 Manhattan        NP 35.211923     a   2.3         2-0.25
## 18    579      Hays        NP 22.881412     ab  2.3         2-0.25
## 19    472   Tribune        AG 40.252754     b   2.7     0.25-0.053
## 20    850 Manhattan        AG 60.480425    a    2.7     0.25-0.053
## 21    579      Hays        AG 61.041555    a    2.7     0.25-0.053
## 22    472   Tribune        EA 60.538628    a      3     0.25-0.053
## 23    850 Manhattan        EA 45.043383     b     3     0.25-0.053
## 24    579      Hays        EA 47.547415     b     3     0.25-0.053
## 25    579      Hays        NP 28.361588      c  3.3     0.25-0.053
## 26    472   Tribune        NP 24.336891      c  3.3     0.25-0.053
## 27    850 Manhattan        NP 23.599879      c  3.3     0.25-0.053
## 28    472   Tribune        AG  4.107500     ab  3.7    0.053-0.020
## 29    579      Hays        AG  8.777500    a    3.7    0.053-0.020
## 30    850 Manhattan        AG  4.812500     ab  3.7    0.053-0.020
## 31    472   Tribune        EA  5.410000     a     4    0.053-0.020
## 32    850 Manhattan        EA  5.047500     a     4    0.053-0.020
## 33    579      Hays        EA  3.777500     b     4    0.053-0.020
## 34    579      Hays        NP  1.757500      c  4.3    0.053-0.020
## 35    472   Tribune        NP  2.182500      b  4.3    0.053-0.020
## 36    850 Manhattan        NP  3.040000      b  4.3    0.053-0.020
##############20 minutes 10-15 cm

x20x200015 <- x20wsa200015p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x20wsa2000vec)

x20x25015 <- x20wsa25015p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x20wsa250vec)

x20x5315 <- x20wsa5315p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x20wsa53vec)

x20x2015 <- x20wsa2015p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x20wsa20vec)

#rbind

x20minx15 <- rbind(x20x200015,x20x25015,x20x5315,x20x2015)

x20minx15
##    precip  location treatment    lsmean .group xloc aggregate_size
## 1     472   Tribune        AG  7.344079      b   .7            8-2
## 2     850 Manhattan        AG  2.653159      b   .7            8-2
## 3     579      Hays        AG  1.931631      b   .7            8-2
## 4     472   Tribune        EA  3.058975      b    1            8-2
## 5     850 Manhattan        EA  4.378598      b    1            8-2
## 6     579      Hays        EA  2.561610      b    1            8-2
## 7     472   Tribune        NP 26.297002     a   1.3            8-2
## 8     850 Manhattan        NP 25.368150     a   1.3            8-2
## 9     579      Hays        NP 23.871558     a   1.3            8-2
## 10    472   Tribune        AG 27.333662     ab  1.7         2-0.25
## 11    579      Hays        AG 32.940850      a  1.7         2-0.25
## 12    850 Manhattan        AG 29.494218      a  1.7         2-0.25
## 13    579      Hays        EA 18.866673      a    2         2-0.25
## 14    472   Tribune        EA 15.882277      b    2         2-0.25
## 15    850 Manhattan        EA 25.795000      a    2         2-0.25
## 16    472   Tribune        NP 31.521145     a   2.3         2-0.25
## 17    850 Manhattan        NP 37.563085      a  2.3         2-0.25
## 18    579      Hays        NP 23.263343      a  2.3         2-0.25
## 19    472   Tribune        AG 43.855421     a   2.7     0.25-0.053
## 20    850 Manhattan        AG 54.041827     a   2.7     0.25-0.053
## 21    579      Hays        AG 44.035286      b  2.7     0.25-0.053
## 22    472   Tribune        EA 51.129566     a     3     0.25-0.053
## 23    579      Hays        EA 59.985325     a     3     0.25-0.053
## 24    850 Manhattan        EA 52.365267     a     3     0.25-0.053
## 25    579      Hays        NP 32.689282      b  3.3     0.25-0.053
## 26    472   Tribune        NP 20.873743      b  3.3     0.25-0.053
## 27    850 Manhattan        NP 19.454231      b  3.3     0.25-0.053
## 28    472   Tribune        AG  4.412500      b  3.7    0.053-0.020
## 29    579      Hays        AG  7.827500     a   3.7    0.053-0.020
## 30    850 Manhattan        AG  3.470000      b  3.7    0.053-0.020
## 31    472   Tribune        EA  8.422500     a     4    0.053-0.020
## 32    850 Manhattan        EA  6.940000     a     4    0.053-0.020
## 33    579      Hays        EA  5.562500     a     4    0.053-0.020
## 34    579      Hays        NP  2.440000      b  4.3    0.053-0.020
## 35    472   Tribune        NP  1.615000      b  4.3    0.053-0.020
## 36    850 Manhattan        NP  1.732500      b  4.3    0.053-0.020
##########
#5 minutes 0-5 cm
##########


x5x20005 <- x5wsa2000p  %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x5wsa2000vec)

x5x2505 <- x5wsa250p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x5wsa250vec)

x5x535 <- x5wsa53p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x5wsa53vec)

x5x205 <- x5wsa20p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x5wsa20vec)

#rbind

x5minx5 <- rbind(x5x20005,x5x2505,x5x535,x5x205)

x5minx5
##    precip  location treatment    lsmean .group xloc aggregate_size
## 1     579      Hays        AG  1.563937      c   .7            8-2
## 2     472   Tribune        AG  6.619284      a   .7            8-2
## 3     850 Manhattan        AG  2.857780      c   .7            8-2
## 4     472   Tribune        EA 10.186894      a    1            8-2
## 5     850 Manhattan        EA 14.241278     b     1            8-2
## 6     579      Hays        EA 25.901540     b     1            8-2
## 7     472   Tribune        NP  8.822787      a  1.3            8-2
## 8     850 Manhattan        NP 25.434619    a    1.3            8-2
## 9     579      Hays        NP 44.065476    a    1.3            8-2
## 10    579      Hays        AG 27.649027      a  1.7         2-0.25
## 11    472   Tribune        AG  9.931781      b  1.7         2-0.25
## 12    850 Manhattan        AG 28.049438      b  1.7         2-0.25
## 13    472   Tribune        EA 29.018520     a     2         2-0.25
## 14    579      Hays        EA 26.595305      a    2         2-0.25
## 15    850 Manhattan        EA 31.323713      b    2         2-0.25
## 16    850 Manhattan        NP 44.262281     a   2.3         2-0.25
## 17    472   Tribune        NP 27.005202     a   2.3         2-0.25
## 18    579      Hays        NP 32.570016      a  2.3         2-0.25
## 19    472   Tribune        AG 51.284628     a   2.7     0.25-0.053
## 20    850 Manhattan        AG 52.782708    a    2.7     0.25-0.053
## 21    579      Hays        AG 46.220153     a   2.7     0.25-0.053
## 22    472   Tribune        EA 35.120163      b    3     0.25-0.053
## 23    579      Hays        EA 39.818455     a     3     0.25-0.053
## 24    850 Manhattan        EA 30.859602     b     3     0.25-0.053
## 25    579      Hays        NP 18.923355      b  3.3     0.25-0.053
## 26    472   Tribune        NP 23.414279      b  3.3     0.25-0.053
## 27    850 Manhattan        NP 12.952119      c  3.3     0.25-0.053
## 28    472   Tribune        AG  6.822500      a  3.7    0.053-0.020
## 29    579      Hays        AG  6.052500      b  3.7    0.053-0.020
## 30    850 Manhattan        AG  3.980000      a  3.7    0.053-0.020
## 31    579      Hays        EA 16.817500     a     4    0.053-0.020
## 32    472   Tribune        EA  4.965000      a    4    0.053-0.020
## 33    850 Manhattan        EA  3.775000      a    4    0.053-0.020
## 34    579      Hays        NP  8.617500      b  4.3    0.053-0.020
## 35    472   Tribune        NP  5.255000      a  4.3    0.053-0.020
## 36    850 Manhattan        NP  1.433954      a  4.3    0.053-0.020
################ 5 minutes 5-10 cm

x5x200010 <- x5wsa200010p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x5wsa2000vec)

x5x25010 <- x5wsa25010p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x5wsa250vec)

x5x5310 <- x5wsa5310p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x5wsa53vec)

x5x2010 <- x5wsa2010p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x5wsa20vec)

#rbind

x5minx10 <- rbind(x5x200010,x5x25010,x5x5310,x5x2010)

x5minx10
##    precip  location treatment    lsmean .group xloc aggregate_size
## 1     472   Tribune        AG  7.358129      a   .7            8-2
## 2     850 Manhattan        AG  4.704605      c   .7            8-2
## 3     579      Hays        AG  3.551578      c   .7            8-2
## 4     472   Tribune        EA  3.989024      a    1            8-2
## 5     850 Manhattan        EA 18.601440     b     1            8-2
## 6     579      Hays        EA 10.999532     b     1            8-2
## 7     472   Tribune        NP  7.784108      a  1.3            8-2
## 8     850 Manhattan        NP 27.719093    a    1.3            8-2
## 9     579      Hays        NP 47.950775    a    1.3            8-2
## 10    579      Hays        AG 16.110140      b  1.7         2-0.25
## 11    472   Tribune        AG 15.926345      b  1.7         2-0.25
## 12    850 Manhattan        AG 41.277747      a  1.7         2-0.25
## 13    472   Tribune        EA 17.127007      b    2         2-0.25
## 14    579      Hays        EA 38.088665     a     2         2-0.25
## 15    850 Manhattan        EA 37.566067      a    2         2-0.25
## 16    472   Tribune        NP 36.000295     a   2.3         2-0.25
## 17    850 Manhattan        NP 44.207087      a  2.3         2-0.25
## 18    579      Hays        NP 37.440809     a   2.3         2-0.25
## 19    472   Tribune        AG 48.790371     a   2.7     0.25-0.053
## 20    850 Manhattan        AG 42.544111     a   2.7     0.25-0.053
## 21    579      Hays        AG 53.844274     a   2.7     0.25-0.053
## 22    472   Tribune        EA 56.268022     a     3     0.25-0.053
## 23    850 Manhattan        EA 23.878426      b    3     0.25-0.053
## 24    579      Hays        EA 52.739372     a     3     0.25-0.053
## 25    579      Hays        NP 26.004243      b  3.3     0.25-0.053
## 26    472   Tribune        NP 28.543049      b  3.3     0.25-0.053
## 27    850 Manhattan        NP 12.828371      b  3.3     0.25-0.053
## 28    472   Tribune        AG  7.580000      a  3.7    0.053-0.020
## 29    579      Hays        AG  5.632500      b  3.7    0.053-0.020
## 30    850 Manhattan        AG  2.252500      a  3.7    0.053-0.020
## 31    850 Manhattan        EA  4.247500      a    4    0.053-0.020
## 32    472   Tribune        EA  6.502500      a    4    0.053-0.020
## 33    579      Hays        EA 11.552500     a     4    0.053-0.020
## 34    579      Hays        NP  9.017500     a   4.3    0.053-0.020
## 35    472   Tribune        NP  4.895000      a  4.3    0.053-0.020
## 36    850 Manhattan        NP  1.715000      a  4.3    0.053-0.020
################ 5 minutes 10-15 cm

x5x200015 <- x5wsa200015p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x5wsa2000vec)

x5x25015 <- x5wsa25015p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x5wsa250vec)

x5x5315 <- x5wsa5315p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x5wsa53vec)

x5x2015 <- x5wsa2015p %>%
  dplyr::select(precip, location, treatment, lsmean, .group, xloc) %>%
  mutate(aggregate_size = x5wsa20vec)

#rbind

x5minx15 <- rbind(x5x200015,x5x25015,x5x5315,x5x2015)

x5minx15
##    precip  location treatment    lsmean .group xloc aggregate_size
## 1     472   Tribune        AG  6.606750      a   .7            8-2
## 2     579      Hays        AG 11.637256      b   .7            8-2
## 3     850 Manhattan        AG  4.467970      b   .7            8-2
## 4     579      Hays        EA  7.687615      b    1            8-2
## 5     472   Tribune        EA  6.572290      a    1            8-2
## 6     850 Manhattan        EA 15.118422     ab    1            8-2
## 7     472   Tribune        NP 14.583834      a  1.3            8-2
## 8     850 Manhattan        NP 26.750084     a   1.3            8-2
## 9     579      Hays        NP 40.495560     a   1.3            8-2
## 10    472   Tribune        AG 19.599914      a  1.7         2-0.25
## 11    850 Manhattan        AG 52.686735      a  1.7         2-0.25
## 12    579      Hays        AG 32.008450      a  1.7         2-0.25
## 13    472   Tribune        EA 32.715244      a    2         2-0.25
## 14    579      Hays        EA 45.464665      a    2         2-0.25
## 15    850 Manhattan        EA 36.017346      a    2         2-0.25
## 16    472   Tribune        NP 18.032457      a  2.3         2-0.25
## 17    850 Manhattan        NP 37.692543      a  2.3         2-0.25
## 18    579      Hays        NP 32.094026      a  2.3         2-0.25
## 19    472   Tribune        AG 54.061937     a   2.7     0.25-0.053
## 20    850 Manhattan        AG 33.095686      a  2.7     0.25-0.053
## 21    579      Hays        AG 32.267456      b  2.7     0.25-0.053
## 22    472   Tribune        EA 41.100643     ab    3     0.25-0.053
## 23    579      Hays        EA 49.596737     a     3     0.25-0.053
## 24    850 Manhattan        EA 29.540473      a    3     0.25-0.053
## 25    579      Hays        NP 26.417570      b  3.3     0.25-0.053
## 26    472   Tribune        NP 33.014734      b  3.3     0.25-0.053
## 27    850 Manhattan        NP 20.066238      a  3.3     0.25-0.053
## 28    472   Tribune        AG  5.557500      a  3.7    0.053-0.020
## 29    579      Hays        AG  5.852500      b  3.7    0.053-0.020
## 30    850 Manhattan        AG  3.072500     ab  3.7    0.053-0.020
## 31    472   Tribune        EA  5.675000      a    4    0.053-0.020
## 32    850 Manhattan        EA  4.202500     a     4    0.053-0.020
## 33    579      Hays        EA 10.870000     a     4    0.053-0.020
## 34    579      Hays        NP  8.927500     a   4.3    0.053-0.020
## 35    472   Tribune        NP  5.085000      a  4.3    0.053-0.020
## 36    850 Manhattan        NP  1.410000      b  4.3    0.053-0.020
############## NAGG

naggp
##   precip  location treatment    lsmean       SE       df  lower.CL  upper.CL
## 1    472   Tribune        NP 63.965361 3.395653 25.35995 56.976913 70.953809
## 2    472   Tribune        EA 18.059249 3.395653 25.35995 11.070801 25.047697
## 3    472   Tribune        AG  8.551010 3.395653 25.35995  1.562563 15.539458
## 4    579      Hays        NP 79.341536 3.395653 25.35995 72.353089 86.329984
## 5    579      Hays        EA 33.661765 3.395653 25.35995 26.673317 40.650213
## 6    579      Hays        AG  8.396014 3.395653 25.35995  1.407567 15.384462
## 7    850 Manhattan        NP 71.105925 3.395653 25.35995 64.117478 78.094373
## 8    850 Manhattan        EA 45.922074 3.395653 25.35995 38.933627 52.910522
## 9    850 Manhattan        AG  1.474729 3.972346 25.86318 -6.692648  9.642106
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4    a         Hays
## 5     b        Hays
## 6      c       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan
nagg10p
##   precip  location treatment    lsmean       SE df   lower.CL  upper.CL .group
## 1    472   Tribune        NP 35.748582 2.917510 26 29.7515545 41.745610     a 
## 2    472   Tribune        AG  5.721995 2.917510 26 -0.2750325 11.719023      b
## 3    472   Tribune        EA  3.686833 2.917510 26 -2.3101946  9.683861      b
## 4    579      Hays        NP 67.060386 2.917510 26 61.0633580 73.057413     a 
## 5    579      Hays        EA  7.599869 2.917510 26  1.6028410 13.596896      b
## 6    579      Hays        AG  6.400527 2.917510 26  0.4034990 12.397554      b
## 7    850 Manhattan        NP 61.784932 2.917510 26 55.7879043 67.781959    a  
## 8    850 Manhattan        EA 32.138297 2.917510 26 26.1412695 38.135325     b 
## 9    850 Manhattan        AG  4.820744 3.452044 26 -2.2750349 11.916522      c
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan
nagg15p
##   precip  location treatment    lsmean       SE       df   lower.CL upper.CL
## 1    472   Tribune        NP 19.990638 3.794838 26.96694 12.2038258 27.77745
## 2    472   Tribune        EA  4.310915 3.794838 26.96694 -3.4758968 12.09773
## 3    472   Tribune        AG  4.156583 3.794838 26.96694 -3.6302288 11.94339
## 4    579      Hays        NP 51.534489 3.794838 26.96694 43.7476771 59.32130
## 5    579      Hays        AG 17.442633 3.794838 26.96694  9.6558211 25.22944
## 6    579      Hays        EA  7.009381 3.794838 26.96694 -0.7774306 14.79619
## 7    850 Manhattan        NP 54.878590 3.794838 26.96694 47.0917776 62.66540
## 8    850 Manhattan        EA 20.871680 3.794838 26.96694 13.0848680 28.65849
## 9    850 Manhattan        AG  9.891704 3.794838 26.96694  2.1048916 17.67852
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4     a        Hays
## 5      b       Hays
## 6      b       Hays
## 7     a   Manhattan
## 8      b  Manhattan
## 9      b  Manhattan

#Final dataframes

x20minx5
##    precip  location treatment     lsmean .group xloc aggregate_size
## 1     579      Hays        AG  0.9315208      b   .7            8-2
## 2     472   Tribune        AG  8.7304187      b   .7            8-2
## 3     850 Manhattan        AG  1.9782694      b   .7            8-2
## 4     472   Tribune        EA  8.8448459      b    1            8-2
## 5     579      Hays        EA  9.3305850      b    1            8-2
## 6     850 Manhattan        EA 11.4886335      b    1            8-2
## 7     472   Tribune        NP 26.3313434     a   1.3            8-2
## 8     850 Manhattan        NP 25.3077401     a   1.3            8-2
## 9     579      Hays        NP 30.8387700     a   1.3            8-2
## 10    579      Hays        AG 11.9734301      b  1.7         2-0.25
## 11    472   Tribune        AG 14.4454999      b  1.7         2-0.25
## 12    850 Manhattan        AG 17.6278247      c  1.7         2-0.25
## 13    472   Tribune        EA 16.2781993      b    2         2-0.25
## 14    579      Hays        EA 22.0219300     a     2         2-0.25
## 15    850 Manhattan        EA 24.9732871     b     2         2-0.25
## 16    472   Tribune        NP 25.6052664     a   2.3         2-0.25
## 17    850 Manhattan        NP 37.2452781    a    2.3         2-0.25
## 18    579      Hays        NP 28.5391700     a   2.3         2-0.25
## 19    472   Tribune        AG 53.0739889     a   2.7     0.25-0.053
## 20    850 Manhattan        AG 61.1650379    a    2.7     0.25-0.053
## 21    579      Hays        AG 69.7972833    a    2.7     0.25-0.053
## 22    472   Tribune        EA 49.1307814     a     3     0.25-0.053
## 23    579      Hays        EA 47.9366450     b     3     0.25-0.053
## 24    850 Manhattan        EA 47.3814008     b     3     0.25-0.053
## 25    579      Hays        NP 14.9092950      c  3.3     0.25-0.053
## 26    472   Tribune        NP 22.2972642      b  3.3     0.25-0.053
## 27    850 Manhattan        NP 16.5634973      c  3.3     0.25-0.053
## 28    472   Tribune        AG  6.1575000     a   3.7    0.053-0.020
## 29    850 Manhattan        AG  7.2450000     a   3.7    0.053-0.020
## 30    579      Hays        AG  5.2825000     a   3.7    0.053-0.020
## 31    472   Tribune        EA  3.9900000     ab    4    0.053-0.020
## 32    579      Hays        EA  3.3750000     a     4    0.053-0.020
## 33    850 Manhattan        EA  5.1450000     a     4    0.053-0.020
## 34    579      Hays        NP  1.0475000      b  4.3    0.053-0.020
## 35    472   Tribune        NP  1.9500000      b  4.3    0.053-0.020
## 36    850 Manhattan        NP  1.9325000      b  4.3    0.053-0.020
x20minx10
##    precip  location treatment    lsmean .group xloc aggregate_size
## 1     472   Tribune        AG  7.158672      b   .7            8-2
## 2     850 Manhattan        AG  3.003322      b   .7            8-2
## 3     579      Hays        AG  1.369402      b   .7            8-2
## 4     472   Tribune        EA  2.303734      b    1            8-2
## 5     850 Manhattan        EA  8.197339      b    1            8-2
## 6     579      Hays        EA  4.312530      b    1            8-2
## 7     472   Tribune        NP 19.874634     a   1.3            8-2
## 8     850 Manhattan        NP 19.539639     a   1.3            8-2
## 9     579      Hays        NP 27.933098     a   1.3            8-2
## 10    472   Tribune        AG 31.380248     a   1.7         2-0.25
## 11    579      Hays        AG 12.446052      b  1.7         2-0.25
## 12    850 Manhattan        AG 19.009357      b  1.7         2-0.25
## 13    579      Hays        EA 29.768317     a     2         2-0.25
## 14    472   Tribune        EA 15.885406      b    2         2-0.25
## 15    850 Manhattan        EA 31.988045     ab    2         2-0.25
## 16    472   Tribune        NP 33.762260     a   2.3         2-0.25
## 17    850 Manhattan        NP 35.211923     a   2.3         2-0.25
## 18    579      Hays        NP 22.881412     ab  2.3         2-0.25
## 19    472   Tribune        AG 40.252754     b   2.7     0.25-0.053
## 20    850 Manhattan        AG 60.480425    a    2.7     0.25-0.053
## 21    579      Hays        AG 61.041555    a    2.7     0.25-0.053
## 22    472   Tribune        EA 60.538628    a      3     0.25-0.053
## 23    850 Manhattan        EA 45.043383     b     3     0.25-0.053
## 24    579      Hays        EA 47.547415     b     3     0.25-0.053
## 25    579      Hays        NP 28.361588      c  3.3     0.25-0.053
## 26    472   Tribune        NP 24.336891      c  3.3     0.25-0.053
## 27    850 Manhattan        NP 23.599879      c  3.3     0.25-0.053
## 28    472   Tribune        AG  4.107500     ab  3.7    0.053-0.020
## 29    579      Hays        AG  8.777500    a    3.7    0.053-0.020
## 30    850 Manhattan        AG  4.812500     ab  3.7    0.053-0.020
## 31    472   Tribune        EA  5.410000     a     4    0.053-0.020
## 32    850 Manhattan        EA  5.047500     a     4    0.053-0.020
## 33    579      Hays        EA  3.777500     b     4    0.053-0.020
## 34    579      Hays        NP  1.757500      c  4.3    0.053-0.020
## 35    472   Tribune        NP  2.182500      b  4.3    0.053-0.020
## 36    850 Manhattan        NP  3.040000      b  4.3    0.053-0.020
x20minx15
##    precip  location treatment    lsmean .group xloc aggregate_size
## 1     472   Tribune        AG  7.344079      b   .7            8-2
## 2     850 Manhattan        AG  2.653159      b   .7            8-2
## 3     579      Hays        AG  1.931631      b   .7            8-2
## 4     472   Tribune        EA  3.058975      b    1            8-2
## 5     850 Manhattan        EA  4.378598      b    1            8-2
## 6     579      Hays        EA  2.561610      b    1            8-2
## 7     472   Tribune        NP 26.297002     a   1.3            8-2
## 8     850 Manhattan        NP 25.368150     a   1.3            8-2
## 9     579      Hays        NP 23.871558     a   1.3            8-2
## 10    472   Tribune        AG 27.333662     ab  1.7         2-0.25
## 11    579      Hays        AG 32.940850      a  1.7         2-0.25
## 12    850 Manhattan        AG 29.494218      a  1.7         2-0.25
## 13    579      Hays        EA 18.866673      a    2         2-0.25
## 14    472   Tribune        EA 15.882277      b    2         2-0.25
## 15    850 Manhattan        EA 25.795000      a    2         2-0.25
## 16    472   Tribune        NP 31.521145     a   2.3         2-0.25
## 17    850 Manhattan        NP 37.563085      a  2.3         2-0.25
## 18    579      Hays        NP 23.263343      a  2.3         2-0.25
## 19    472   Tribune        AG 43.855421     a   2.7     0.25-0.053
## 20    850 Manhattan        AG 54.041827     a   2.7     0.25-0.053
## 21    579      Hays        AG 44.035286      b  2.7     0.25-0.053
## 22    472   Tribune        EA 51.129566     a     3     0.25-0.053
## 23    579      Hays        EA 59.985325     a     3     0.25-0.053
## 24    850 Manhattan        EA 52.365267     a     3     0.25-0.053
## 25    579      Hays        NP 32.689282      b  3.3     0.25-0.053
## 26    472   Tribune        NP 20.873743      b  3.3     0.25-0.053
## 27    850 Manhattan        NP 19.454231      b  3.3     0.25-0.053
## 28    472   Tribune        AG  4.412500      b  3.7    0.053-0.020
## 29    579      Hays        AG  7.827500     a   3.7    0.053-0.020
## 30    850 Manhattan        AG  3.470000      b  3.7    0.053-0.020
## 31    472   Tribune        EA  8.422500     a     4    0.053-0.020
## 32    850 Manhattan        EA  6.940000     a     4    0.053-0.020
## 33    579      Hays        EA  5.562500     a     4    0.053-0.020
## 34    579      Hays        NP  2.440000      b  4.3    0.053-0.020
## 35    472   Tribune        NP  1.615000      b  4.3    0.053-0.020
## 36    850 Manhattan        NP  1.732500      b  4.3    0.053-0.020
x5minx5
##    precip  location treatment    lsmean .group xloc aggregate_size
## 1     579      Hays        AG  1.563937      c   .7            8-2
## 2     472   Tribune        AG  6.619284      a   .7            8-2
## 3     850 Manhattan        AG  2.857780      c   .7            8-2
## 4     472   Tribune        EA 10.186894      a    1            8-2
## 5     850 Manhattan        EA 14.241278     b     1            8-2
## 6     579      Hays        EA 25.901540     b     1            8-2
## 7     472   Tribune        NP  8.822787      a  1.3            8-2
## 8     850 Manhattan        NP 25.434619    a    1.3            8-2
## 9     579      Hays        NP 44.065476    a    1.3            8-2
## 10    579      Hays        AG 27.649027      a  1.7         2-0.25
## 11    472   Tribune        AG  9.931781      b  1.7         2-0.25
## 12    850 Manhattan        AG 28.049438      b  1.7         2-0.25
## 13    472   Tribune        EA 29.018520     a     2         2-0.25
## 14    579      Hays        EA 26.595305      a    2         2-0.25
## 15    850 Manhattan        EA 31.323713      b    2         2-0.25
## 16    850 Manhattan        NP 44.262281     a   2.3         2-0.25
## 17    472   Tribune        NP 27.005202     a   2.3         2-0.25
## 18    579      Hays        NP 32.570016      a  2.3         2-0.25
## 19    472   Tribune        AG 51.284628     a   2.7     0.25-0.053
## 20    850 Manhattan        AG 52.782708    a    2.7     0.25-0.053
## 21    579      Hays        AG 46.220153     a   2.7     0.25-0.053
## 22    472   Tribune        EA 35.120163      b    3     0.25-0.053
## 23    579      Hays        EA 39.818455     a     3     0.25-0.053
## 24    850 Manhattan        EA 30.859602     b     3     0.25-0.053
## 25    579      Hays        NP 18.923355      b  3.3     0.25-0.053
## 26    472   Tribune        NP 23.414279      b  3.3     0.25-0.053
## 27    850 Manhattan        NP 12.952119      c  3.3     0.25-0.053
## 28    472   Tribune        AG  6.822500      a  3.7    0.053-0.020
## 29    579      Hays        AG  6.052500      b  3.7    0.053-0.020
## 30    850 Manhattan        AG  3.980000      a  3.7    0.053-0.020
## 31    579      Hays        EA 16.817500     a     4    0.053-0.020
## 32    472   Tribune        EA  4.965000      a    4    0.053-0.020
## 33    850 Manhattan        EA  3.775000      a    4    0.053-0.020
## 34    579      Hays        NP  8.617500      b  4.3    0.053-0.020
## 35    472   Tribune        NP  5.255000      a  4.3    0.053-0.020
## 36    850 Manhattan        NP  1.433954      a  4.3    0.053-0.020
x5minx10
##    precip  location treatment    lsmean .group xloc aggregate_size
## 1     472   Tribune        AG  7.358129      a   .7            8-2
## 2     850 Manhattan        AG  4.704605      c   .7            8-2
## 3     579      Hays        AG  3.551578      c   .7            8-2
## 4     472   Tribune        EA  3.989024      a    1            8-2
## 5     850 Manhattan        EA 18.601440     b     1            8-2
## 6     579      Hays        EA 10.999532     b     1            8-2
## 7     472   Tribune        NP  7.784108      a  1.3            8-2
## 8     850 Manhattan        NP 27.719093    a    1.3            8-2
## 9     579      Hays        NP 47.950775    a    1.3            8-2
## 10    579      Hays        AG 16.110140      b  1.7         2-0.25
## 11    472   Tribune        AG 15.926345      b  1.7         2-0.25
## 12    850 Manhattan        AG 41.277747      a  1.7         2-0.25
## 13    472   Tribune        EA 17.127007      b    2         2-0.25
## 14    579      Hays        EA 38.088665     a     2         2-0.25
## 15    850 Manhattan        EA 37.566067      a    2         2-0.25
## 16    472   Tribune        NP 36.000295     a   2.3         2-0.25
## 17    850 Manhattan        NP 44.207087      a  2.3         2-0.25
## 18    579      Hays        NP 37.440809     a   2.3         2-0.25
## 19    472   Tribune        AG 48.790371     a   2.7     0.25-0.053
## 20    850 Manhattan        AG 42.544111     a   2.7     0.25-0.053
## 21    579      Hays        AG 53.844274     a   2.7     0.25-0.053
## 22    472   Tribune        EA 56.268022     a     3     0.25-0.053
## 23    850 Manhattan        EA 23.878426      b    3     0.25-0.053
## 24    579      Hays        EA 52.739372     a     3     0.25-0.053
## 25    579      Hays        NP 26.004243      b  3.3     0.25-0.053
## 26    472   Tribune        NP 28.543049      b  3.3     0.25-0.053
## 27    850 Manhattan        NP 12.828371      b  3.3     0.25-0.053
## 28    472   Tribune        AG  7.580000      a  3.7    0.053-0.020
## 29    579      Hays        AG  5.632500      b  3.7    0.053-0.020
## 30    850 Manhattan        AG  2.252500      a  3.7    0.053-0.020
## 31    850 Manhattan        EA  4.247500      a    4    0.053-0.020
## 32    472   Tribune        EA  6.502500      a    4    0.053-0.020
## 33    579      Hays        EA 11.552500     a     4    0.053-0.020
## 34    579      Hays        NP  9.017500     a   4.3    0.053-0.020
## 35    472   Tribune        NP  4.895000      a  4.3    0.053-0.020
## 36    850 Manhattan        NP  1.715000      a  4.3    0.053-0.020
x5minx15
##    precip  location treatment    lsmean .group xloc aggregate_size
## 1     472   Tribune        AG  6.606750      a   .7            8-2
## 2     579      Hays        AG 11.637256      b   .7            8-2
## 3     850 Manhattan        AG  4.467970      b   .7            8-2
## 4     579      Hays        EA  7.687615      b    1            8-2
## 5     472   Tribune        EA  6.572290      a    1            8-2
## 6     850 Manhattan        EA 15.118422     ab    1            8-2
## 7     472   Tribune        NP 14.583834      a  1.3            8-2
## 8     850 Manhattan        NP 26.750084     a   1.3            8-2
## 9     579      Hays        NP 40.495560     a   1.3            8-2
## 10    472   Tribune        AG 19.599914      a  1.7         2-0.25
## 11    850 Manhattan        AG 52.686735      a  1.7         2-0.25
## 12    579      Hays        AG 32.008450      a  1.7         2-0.25
## 13    472   Tribune        EA 32.715244      a    2         2-0.25
## 14    579      Hays        EA 45.464665      a    2         2-0.25
## 15    850 Manhattan        EA 36.017346      a    2         2-0.25
## 16    472   Tribune        NP 18.032457      a  2.3         2-0.25
## 17    850 Manhattan        NP 37.692543      a  2.3         2-0.25
## 18    579      Hays        NP 32.094026      a  2.3         2-0.25
## 19    472   Tribune        AG 54.061937     a   2.7     0.25-0.053
## 20    850 Manhattan        AG 33.095686      a  2.7     0.25-0.053
## 21    579      Hays        AG 32.267456      b  2.7     0.25-0.053
## 22    472   Tribune        EA 41.100643     ab    3     0.25-0.053
## 23    579      Hays        EA 49.596737     a     3     0.25-0.053
## 24    850 Manhattan        EA 29.540473      a    3     0.25-0.053
## 25    579      Hays        NP 26.417570      b  3.3     0.25-0.053
## 26    472   Tribune        NP 33.014734      b  3.3     0.25-0.053
## 27    850 Manhattan        NP 20.066238      a  3.3     0.25-0.053
## 28    472   Tribune        AG  5.557500      a  3.7    0.053-0.020
## 29    579      Hays        AG  5.852500      b  3.7    0.053-0.020
## 30    850 Manhattan        AG  3.072500     ab  3.7    0.053-0.020
## 31    472   Tribune        EA  5.675000      a    4    0.053-0.020
## 32    850 Manhattan        EA  4.202500     a     4    0.053-0.020
## 33    579      Hays        EA 10.870000     a     4    0.053-0.020
## 34    579      Hays        NP  8.927500     a   4.3    0.053-0.020
## 35    472   Tribune        NP  5.085000      a  4.3    0.053-0.020
## 36    850 Manhattan        NP  1.410000      b  4.3    0.053-0.020
naggp
##   precip  location treatment    lsmean       SE       df  lower.CL  upper.CL
## 1    472   Tribune        NP 63.965361 3.395653 25.35995 56.976913 70.953809
## 2    472   Tribune        EA 18.059249 3.395653 25.35995 11.070801 25.047697
## 3    472   Tribune        AG  8.551010 3.395653 25.35995  1.562563 15.539458
## 4    579      Hays        NP 79.341536 3.395653 25.35995 72.353089 86.329984
## 5    579      Hays        EA 33.661765 3.395653 25.35995 26.673317 40.650213
## 6    579      Hays        AG  8.396014 3.395653 25.35995  1.407567 15.384462
## 7    850 Manhattan        NP 71.105925 3.395653 25.35995 64.117478 78.094373
## 8    850 Manhattan        EA 45.922074 3.395653 25.35995 38.933627 52.910522
## 9    850 Manhattan        AG  1.474729 3.972346 25.86318 -6.692648  9.642106
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4    a         Hays
## 5     b        Hays
## 6      c       Hays
## 7    a    Manhattan
## 8     b   Manhattan
## 9      c  Manhattan
nagg10p
##   precip  location treatment    lsmean       SE df   lower.CL  upper.CL .group
## 1    472   Tribune        NP 35.748582 2.917510 26 29.7515545 41.745610     a 
## 2    472   Tribune        AG  5.721995 2.917510 26 -0.2750325 11.719023      b
## 3    472   Tribune        EA  3.686833 2.917510 26 -2.3101946  9.683861      b
## 4    579      Hays        NP 67.060386 2.917510 26 61.0633580 73.057413     a 
## 5    579      Hays        EA  7.599869 2.917510 26  1.6028410 13.596896      b
## 6    579      Hays        AG  6.400527 2.917510 26  0.4034990 12.397554      b
## 7    850 Manhattan        NP 61.784932 2.917510 26 55.7879043 67.781959    a  
## 8    850 Manhattan        EA 32.138297 2.917510 26 26.1412695 38.135325     b 
## 9    850 Manhattan        AG  4.820744 3.452044 26 -2.2750349 11.916522      c
##   location_f
## 1    Tribune
## 2    Tribune
## 3    Tribune
## 4       Hays
## 5       Hays
## 6       Hays
## 7  Manhattan
## 8  Manhattan
## 9  Manhattan
nagg15p
##   precip  location treatment    lsmean       SE       df   lower.CL upper.CL
## 1    472   Tribune        NP 19.990638 3.794838 26.96694 12.2038258 27.77745
## 2    472   Tribune        EA  4.310915 3.794838 26.96694 -3.4758968 12.09773
## 3    472   Tribune        AG  4.156583 3.794838 26.96694 -3.6302288 11.94339
## 4    579      Hays        NP 51.534489 3.794838 26.96694 43.7476771 59.32130
## 5    579      Hays        AG 17.442633 3.794838 26.96694  9.6558211 25.22944
## 6    579      Hays        EA  7.009381 3.794838 26.96694 -0.7774306 14.79619
## 7    850 Manhattan        NP 54.878590 3.794838 26.96694 47.0917776 62.66540
## 8    850 Manhattan        EA 20.871680 3.794838 26.96694 13.0848680 28.65849
## 9    850 Manhattan        AG  9.891704 3.794838 26.96694  2.1048916 17.67852
##   .group location_f
## 1     a     Tribune
## 2      b    Tribune
## 3      b    Tribune
## 4     a        Hays
## 5      b       Hays
## 6      b       Hays
## 7     a   Manhattan
## 8      b  Manhattan
## 9      b  Manhattan

7.1 end

7.2 1) Load packages

library(readxl)
library(dplyr)
library(tidyr)
library(ggplot2)
library(janitor)
library(grid)
library(ggthemes)

library(extrafont)
#font_import()
loadfonts(device = "win")
windowsFonts(Times = windowsFont("TT Times New Roman"))


library(tidyverse)
library(corrplot)
#library(plyr)

library(ggpubr)
library(dplyr)

library(ggforce)

7.3 2) Import data

#import data
soilhealth <- read_excel("3-30-21 part 8.1 nrcs soil health agg.xlsx")

7.4 3) Data Wrangling

#change column names
soilhealth1 <- soilhealth %>% 
  clean_names()
#str(soilhealth)
#View(soilhealth)

names(soilhealth1)
##  [1] "sample_name" "location"    "treatment"   "depth"       "replication"
##  [6] "bdepth"      "nhorizon"    "blk"         "horizon"     "x20wsa2000" 
## [11] "x20wsa250"   "x20wsa53"    "x20wsa20"    "x20mwd"      "x5wsa2000"  
## [16] "x5wsa250"    "x5wsa53"     "x5wsa20"     "x5mwd"       "nagg"
soilhealth1 <- as.data.frame(soilhealth1)

# keeps aggregate data
agg <- soilhealth1 %>%
  dplyr::select(location, treatment, bdepth, horizon, blk, replication, x20wsa2000, x20wsa250, x20wsa53, x20wsa20, x20mwd, x5wsa2000, x5wsa250, x5wsa53, x5wsa20, x5mwd, nagg)

soils <- agg %>%
    filter(location!="Ottawa", treatment!="IR")


agg$location_f =factor(agg$location, levels=c('Tribune', 'Hays', 'Manhattan'))
#str(agg)
#View(agg)

agg1 <- agg%>%
  filter(horizon=="1", location!="Ottawa", treatment!="IR")

agg2 <- agg%>%
  filter(horizon=="2", location!="Ottawa", treatment!="IR")

agg3 <- agg%>%
  filter(horizon=="3", location!="Ottawa", treatment!="IR")

agg4 <- agg%>%
  filter(horizon=="4", location!="Ottawa", treatment!="IR")

aggmwd <- agg %>%
  filter(location!="Ottawa", treatment!="IR") %>%
  na.omit()

agg1$location_f =factor(agg1$location, levels=c('Tribune', 'Hays', 'Manhattan'))

7.5 4) Theme James Bar

theme_James <- function(base_size=14, base_family="TT Times New Roman") {
  (theme_foundation(base_size=base_size, base_family=base_family)+
      theme_bw()+ 
      theme(panel.background = element_rect(colour = NA),
            plot.background = element_rect(colour = NA),
            axis.title = element_text(color="black",size=rel(1.2)),
            axis.text = element_text(color="black", size = 12),
            legend.key = element_rect(colour = NA),
            legend.spacing = unit(0, "cm"),
            legend.text = element_text(size=12),
            legend.title = element_blank(),
            panel.grid = element_blank(),
            plot.title = element_text(color="Black",size = rel(1.5),face = "bold",hjust = 0.5),
            strip.text = element_text(color="Black",size = rel(1),face="bold")
      ))
}

7.6 5) Theme James Correlation

theme_James2 <- function(base_size=14, base_family="TT Times New Roman") {
  (theme_foundation(base_size=base_size, base_family=base_family)+
      theme_bw()+ 
      theme(panel.background = element_rect(colour = NA),
            plot.background = element_rect(colour = NA),
            axis.title = element_text(color="black",size=rel(1.2)),
            axis.text = element_text(color="black", size = 12),
            legend.key = element_rect(colour = NA),
            legend.spacing = unit(0, "cm"),
            legend.text = element_text(size=12),
            panel.grid = element_blank(),
            plot.title = element_text(color="Black",size = rel(1.5),face = "bold",hjust = 0.5),
            strip.text = element_text(color="Black",size = rel(1),face="bold")
      ))
}

8 Correlation Matrix

names(agg)
##  [1] "location"    "treatment"   "bdepth"      "horizon"     "blk"        
##  [6] "replication" "x20wsa2000"  "x20wsa250"   "x20wsa53"    "x20wsa20"   
## [11] "x20mwd"      "x5wsa2000"   "x5wsa250"    "x5wsa53"     "x5wsa20"    
## [16] "x5mwd"       "nagg"        "location_f"
aggmatrix <- agg %>%
  filter(location!="Ottawa", treatment!="IR") %>% 
  dplyr::select(-location, -treatment, -bdepth, -horizon, -blk, -replication) %>%
  dplyr::select(where(is.numeric)) %>% drop_na()

aggmatrix <- na.omit(aggmatrix)



aggmatrix1 <- aggmatrix[, c(5,1,2,3,4,10,6,7,8,9,11)]

#aggmatrix1

aggmat <- cor(aggmatrix1, method = "spearman")
#aggmat

#library("writexl")
#aggmatdf <- as.data.frame(aggmat)
#write_xlsx(aggmatdf,"aggmatdf.xlsx")

library("PerformanceAnalytics")

chart.Correlation(aggmatrix1, histogram = TRUE, pch = 19, method="spearman")

# use exact=FALSE

chart.Correlation(aggmatrix1, histogram = TRUE, pch = 19, method="spearman", exact=FALSE)

colnames(aggmat) <- c( "20 min MWD","20 min 2 mm", "20 min 0.250 mm", "20 min 0.053 mm", "20 min 0.020 mm", "5 min MWD", "5 min 2 mm", "5 min 0.25 mm", "5 min 0.053 mm", "5 min 0.020 mm", "NRCS")

rownames(aggmat) <- c( "20 min MWD","20 min 2 mm", "20 min 0.250 mm", "20 min 0.053 mm", "20 min 0.020 mm", "5 min MWD", "5 min 2 mm", "5 min 0.25 mm", "5 min 0.053 mm", "5 min 0.020 mm", "NRCS")

corrplot(aggmat, method = "square", tl.col = "black", type = "lower", tl.srt = 45, tl.cex = 0.7)

#corrplot.mixed(aggmat, lower.col = "black", number.cex = .7)

#corrplot(aggmat, type = "lower")

corrplot(aggmat, method = "pie",type = "lower", tl.srt = 20, tl.col="black")

#head(p.matr[,])
# cl.* is for color legend, and tl.* if for text legend.

res1<- cor.mtest(aggmat, conf.level=0.95)

#Significance level
fcor <- corrplot(aggmat, method = "pie",type = "upper", tl.srt = 20, tl.col="black", p.mat=res1$p, sig.level = 0.05, title = "Spearman Correlation Matrix p > 0.05")

corrplot(aggmat, method = "number",type = "upper", tl.srt = 20, tl.col="black", p.mat=res1$p, sig.level = 0.05, title = "Spearman Correlation Matrix p > 0.05")

9 20 min Aggregate Graphs

9.1 Aggregate function

#function to calculate the mean and standard error

#0-5 cm
mean_se_fx_20_1 <- function(select_variable, aggregate_size, aggregate_size_conversion){
  subset_data <- agg1[, select_variable]
  subset_data_1 <- gather(subset_data, aggregate_size , value, - treatment, - location)
  subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size, 
                                         levels = aggregate_size)
  subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size, 
                                                  from=aggregate_size, to=aggregate_size_conversion)
  se <- function(x, na.rm=TRUE) {
    if (na.rm) x <- na.omit(x)
    sqrt(var(x)/length(x))
  }
  subset_data_2 <- subset_data_1 %>% group_by(location, treatment, aggregate_size) %>%
    summarize(mean_data = mean(value, na.rm = TRUE), standard_error = se(value))
    #Reposition location labels
  subset_data_2$location <- factor(subset_data_2$location, levels = c("Tribune", "Hays", "Manhattan")) 
  return(subset_data_2)
}

#5-10 cm
mean_se_fx_20_2 <- function(select_variable, aggregate_size, aggregate_size_conversion){
  subset_data <- agg2[, select_variable]
  subset_data_1 <- gather(subset_data, aggregate_size , value, - treatment, - location)
  subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size, 
                                         levels = aggregate_size)
  subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size, 
                                                  from=aggregate_size, to=aggregate_size_conversion)
  se <- function(x, na.rm=TRUE) {
    if (na.rm) x <- na.omit(x)
    sqrt(var(x)/length(x))
  }
  subset_data_2 <- subset_data_1 %>% group_by(location, treatment, aggregate_size) %>%
    summarize(mean_data = mean(value, na.rm = TRUE), standard_error = se(value))
    #Reposition location labels
  subset_data_2$location <- factor(subset_data_2$location, levels = c("Tribune", "Hays", "Manhattan")) 
  return(subset_data_2)
}

#10-15 cm
mean_se_fx_20_3 <- function(select_variable, aggregate_size, aggregate_size_conversion){
  subset_data <- agg3[, select_variable]
  subset_data_1 <- gather(subset_data, aggregate_size , value, - treatment, - location)
  subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size, 
                                         levels = aggregate_size)
  subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size, 
                                                  from=aggregate_size, to=aggregate_size_conversion)
  se <- function(x, na.rm=TRUE) {
    if (na.rm) x <- na.omit(x)
    sqrt(var(x)/length(x))
  }
  subset_data_2 <- subset_data_1 %>% group_by(location, treatment, aggregate_size) %>%
    summarize(mean_data = mean(value, na.rm = TRUE), standard_error = se(value))
    #Reposition location labels
  subset_data_2$location <- factor(subset_data_2$location, levels = c("Tribune", "Hays", "Manhattan")) 
  return(subset_data_2)
}

#15- 25 or 40 cm
mean_se_fx_20_4 <- function(select_variable, aggregate_size, aggregate_size_conversion){
  subset_data <- agg4[, select_variable]
  subset_data_1 <- gather(subset_data, aggregate_size , value, - treatment, - location)
  subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size, 
                                         levels = aggregate_size)
  subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size, 
                                                  from=aggregate_size, to=aggregate_size_conversion)
  se <- function(x, na.rm=TRUE) {
    if (na.rm) x <- na.omit(x)
    sqrt(var(x)/length(x))
  }
  subset_data_2 <- subset_data_1 %>% group_by(location, treatment, aggregate_size) %>%
    summarize(mean_data = mean(value, na.rm = TRUE), standard_error = se(value))
    #Reposition location labels
  subset_data_2$location <- factor(subset_data_2$location, levels = c("Tribune", "Hays", "Manhattan")) 
  return(subset_data_2)
}


#the color palette for the Treatments
colsnp <- c( "AG" = "black", "EA" = "grey40", "NP" = "grey90")

library(dplyr)

9.2 0-5 cm 20 minutes

method_20_1 <- mean_se_fx_20_1(c("treatment", "location", "x20wsa2000", 
                          "x20wsa250", "x20wsa53", "x20wsa20"),
                        c("x20wsa2000", "x20wsa250", "x20wsa53", "x20wsa20"),
                        c("8-2", "2-0.25", "0.25-0.053", "0.053-0.020"))


method_20_1$location_f =factor(method_20_1$location, levels=c('Tribune', 'Hays', 'Manhattan'))


method20min5cm <- merge(method_20_1, x20minx5, by=c("location", "treatment", "aggregate_size"))


ggplot(data=method20min5cm, aes(x=aggregate_size, y=mean_data, fill = treatment)) + 
  geom_bar(position=position_dodge(), stat="identity", colour = "black") +
  geom_errorbar(aes(ymin=mean_data-standard_error, ymax=mean_data+standard_error),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9)) + ylab("Mean value") + 
  scale_y_continuous(limits=c(0,80)) +  facet_wrap(facets=vars(location_f), strip.position="bottom")  + 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        legend.position="top",
        panel.border = element_rect(colour = "black", fill=NA, size=0.5),
        strip.background=element_rect(size=0.5, colour = "black"),
        axis.text.x=element_text(colour="black", size=10)) + xlab("Aggregate size fractions (mm)") + 
  ylab(expression(g ~100 ~g^{-1} ~soil)) +
  ggtitle("20 Minute Aggregate Fractions in 0-5 cm Depth") + scale_fill_manual(values = colsnp) + 
  theme_James()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
  geom_text(aes(label=.group, y=mean_data + standard_error + 3), position = position_dodge(0.9), vjust=0) 

#+ ggsave("20min0_5cm.png",  height=6, width=9)

9.3 5-10 cm 20 minutes

method_20_2 <- mean_se_fx_20_2(c("treatment", "location", "x20wsa2000", 
                          "x20wsa250", "x20wsa53", "x20wsa20"),
                        c("x20wsa2000", "x20wsa250", "x20wsa53", "x20wsa20"),
                        c("8-2", "2-0.25", "0.25-0.053", "0.053-0.020"))

method_20_2$location_f =factor(method_20_2$location, levels=c('Tribune', 'Hays', 'Manhattan'))

method20min10cm <- merge(method_20_2, x20minx10, by=c("location", "treatment", "aggregate_size"))

ggplot(data=method20min10cm, aes(x=aggregate_size, y=mean_data, fill = treatment)) + 
  geom_bar(position=position_dodge(), stat="identity", colour = "black") +
  geom_errorbar(aes(ymin=mean_data-standard_error, ymax=mean_data+standard_error),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9)) + ylab("Mean value") + 
  scale_y_continuous(limits=c(0,80)) +  facet_wrap(facets=vars(location_f), strip.position="bottom")  + 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        legend.position="top",
        panel.border = element_rect(colour = "black", fill=NA, size=0.5),
        strip.background=element_rect(size=0.5, colour = "black"),
        axis.text.x=element_text(colour="black", size=10)) + xlab("Aggregate size fractions (mm)") + 
  ylab(expression(g ~100 ~g^{-1} ~soil)) +
  ggtitle("20 Minute Aggregate Fractions in 5-10 cm Depth") + scale_fill_manual(values = colsnp) + 
  theme_James()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
  geom_text(aes(label=.group, y=mean_data + standard_error + 3), position = position_dodge(0.9), vjust=0) 

#+ ggsave("20min5_10cm.png",  height=6, width=9)

9.4 10-15 cm 20 minutes

method_20_3 <- mean_se_fx_20_3(c("treatment", "location", "x20wsa2000", 
                          "x20wsa250", "x20wsa53", "x20wsa20"),
                        c("x20wsa2000", "x20wsa250", "x20wsa53", "x20wsa20"),
                        c("8-2", "2-0.25", "0.25-0.053", "0.053-0.020"))

method_20_3$location_f =factor(method_20_3$location, levels=c('Tribune', 'Hays', 'Manhattan'))

method20min15cm <- merge(method_20_3, x20minx15, by=c("location", "treatment", "aggregate_size"))

ggplot(data=method20min15cm, aes(x=aggregate_size, y=mean_data, fill = treatment)) + 
  geom_bar(position=position_dodge(), stat="identity", colour = "black") +
  geom_errorbar(aes(ymin=mean_data-standard_error, ymax=mean_data+standard_error),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9)) + ylab("Mean value") + 
  scale_y_continuous(limits=c(0,80)) +  facet_wrap(facets=vars(location_f), strip.position="bottom")  + 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        legend.position="top",
        panel.border = element_rect(colour = "black", fill=NA, size=0.5),
        strip.background=element_rect(size=0.5, colour = "black"),
        axis.text.x=element_text(colour="black", size=10)) + xlab("Aggregate size fractions (mm)") + 
  ylab(expression(g ~100 ~g^{-1} ~soil)) +
  ggtitle("20 Minute Aggregate Fractions in 10-15 cm Depth") + scale_fill_manual(values = colsnp) + 
  theme_James()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
  geom_text(aes(label=.group, y=mean_data + standard_error + 3), position = position_dodge(0.9), vjust=0) 

#+ ggsave("20min10_15cm.png",  height=6, width=9)

9.5 15-25 cm 20 minutes

method_20_4 <- mean_se_fx_20_4(c("treatment", "location", "x20wsa2000", 
                          "x20wsa250", "x20wsa53", "x20wsa20"),
                        c("x20wsa2000", "x20wsa250", "x20wsa53", "x20wsa20"),
                        c("8-2", "2-0.25", "0.25-0.053", "0.053-0.020"))

method_20_4$location_f =factor(method_20_4$location, levels=c('Tribune', 'Hays', 'Manhattan'))


ggplot(data=method_20_4, aes(x=aggregate_size, y=mean_data, fill = treatment)) + 
  geom_bar(position=position_dodge(), stat="identity", colour = "black") +
  geom_errorbar(aes(ymin=mean_data-standard_error, ymax=mean_data+standard_error),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9)) + ylab("Mean value") + 
  scale_y_continuous(limits=c(0,80)) +  facet_wrap(facets=vars(location_f), strip.position="bottom")  + 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        legend.position="top",
        panel.border = element_rect(colour = "black", fill=NA, size=0.5),
        strip.background=element_rect(size=0.5, colour = "black"),
        axis.text.x=element_text(colour="black", size=10)) + xlab("Aggregate size fractions (mm)") + 
  ylab(expression(g ~100 ~g^{-1} ~soil)) +
  ggtitle("20 Minute Aggregate Fractions in 15-25 cm Depth") + scale_fill_manual(values = colsnp) + 
  theme_James()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))

10 5 min Aggregate Graphs

10.1 Aggregate function

#function to calculate the mean and standard error

#0-5 cm
mean_se_fx_5_1 <- function(select_variable, aggregate_size, aggregate_size_conversion){
  subset_data <- agg1[, select_variable]
  subset_data_1 <- gather(subset_data, aggregate_size , value, - treatment, - location)
  subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size, 
                                         levels = aggregate_size)
  subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size, 
                                                  from=aggregate_size, to=aggregate_size_conversion)
  se <- function(x, na.rm=TRUE) {
    if (na.rm) x <- na.omit(x)
    sqrt(var(x)/length(x))
  }
  subset_data_2 <- subset_data_1 %>% group_by(location, treatment, aggregate_size) %>%
    summarize(mean_data = mean(value, na.rm = TRUE), standard_error = se(value))
    #Reposition location labels
  subset_data_2$location <- factor(subset_data_2$location, levels = c("Tribune", "Hays", "Manhattan")) 
  return(subset_data_2)
}

#5-10 cm
mean_se_fx_5_2 <- function(select_variable, aggregate_size, aggregate_size_conversion){
  subset_data <- agg2[, select_variable]
  subset_data_1 <- gather(subset_data, aggregate_size , value, - treatment, - location)
  subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size, 
                                         levels = aggregate_size)
  subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size, 
                                                  from=aggregate_size, to=aggregate_size_conversion)
  se <- function(x, na.rm=TRUE) {
    if (na.rm) x <- na.omit(x)
    sqrt(var(x)/length(x))
  }
  subset_data_2 <- subset_data_1 %>% group_by(location, treatment, aggregate_size) %>%
    summarize(mean_data = mean(value, na.rm = TRUE), standard_error = se(value))
    #Reposition location labels
  subset_data_2$location <- factor(subset_data_2$location, levels = c("Tribune", "Hays", "Manhattan")) 
  return(subset_data_2)
}

#10-15 cm
mean_se_fx_5_3 <- function(select_variable, aggregate_size, aggregate_size_conversion){
  subset_data <- agg3[, select_variable]
  subset_data_1 <- gather(subset_data, aggregate_size , value, - treatment, - location)
  subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size, 
                                         levels = aggregate_size)
  subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size, 
                                                  from=aggregate_size, to=aggregate_size_conversion)
  se <- function(x, na.rm=TRUE) {
    if (na.rm) x <- na.omit(x)
    sqrt(var(x)/length(x))
  }
  subset_data_2 <- subset_data_1 %>% group_by(location, treatment, aggregate_size) %>%
    summarize(mean_data = mean(value, na.rm = TRUE), standard_error = se(value))
    #Reposition location labels
  subset_data_2$location <- factor(subset_data_2$location, levels = c("Tribune", "Hays", "Manhattan")) 
  return(subset_data_2)
}

#15- 25 or 40 cm
mean_se_fx_5_4 <- function(select_variable, aggregate_size, aggregate_size_conversion){
  subset_data <- agg4[, select_variable]
  subset_data_1 <- gather(subset_data, aggregate_size , value, - treatment, - location)
  subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size, 
                                         levels = aggregate_size)
  subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size, 
                                                  from=aggregate_size, to=aggregate_size_conversion)
  se <- function(x, na.rm=TRUE) {
    if (na.rm) x <- na.omit(x)
    sqrt(var(x)/length(x))
  }
  subset_data_2 <- subset_data_1 %>% group_by(location, treatment, aggregate_size) %>%
    summarize(mean_data = mean(value, na.rm = TRUE), standard_error = se(value))
    #Reposition location labels
  subset_data_2$location <- factor(subset_data_2$location, levels = c("Tribune", "Hays", "Manhattan")) 
  return(subset_data_2)
}

#the color palette for the Treatments
colsnp <- c( "AG" = "black", "EA" = "grey40", "NP" = "grey90")

10.2 0-5 cm 5 minutes

method_5_1 <- mean_se_fx_5_1(c("treatment", "location", "x5wsa2000", 
                          "x5wsa250", "x5wsa53", "x5wsa20"),
                        c("x5wsa2000", "x5wsa250", "x5wsa53", "x5wsa20"),
                        c("8-2", "2-0.25", "0.25-0.053", "0.053-0.020"))


method_5_1$location_f =factor(method_5_1$location, levels=c('Tribune', 'Hays', 'Manhattan'))


method5min5cm <- merge(method_5_1, x5minx5, by=c("location", "treatment", "aggregate_size"))

ggplot(data=method5min5cm, aes(x=aggregate_size, y=mean_data, fill = treatment)) + 
  geom_bar(position=position_dodge(), stat="identity", colour = "black") +
  geom_errorbar(aes(ymin=mean_data-standard_error, ymax=mean_data+standard_error),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9)) + ylab("Mean value") + 
  scale_y_continuous(limits=c(0,80)) +  facet_wrap(facets=vars(location_f), strip.position="bottom")  + 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        legend.position="top",
        panel.border = element_rect(colour = "black", fill=NA, size=0.5),
        strip.background=element_rect(size=0.5, colour = "black"),
        axis.text.x=element_text(colour="black", size=10)) + xlab("Aggregate size fractions (mm)") + 
  ylab(expression(g ~100 ~g^{-1} ~soil)) +
  ggtitle("5 Minute Aggregate Fractions in 0-5 cm Depth") + scale_fill_manual(values = colsnp) + 
  theme_James()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
  geom_text(aes(label=.group, y=mean_data + standard_error + 3), position = position_dodge(0.9), vjust=0) 

#+  ggsave("5min0_5cm.png",  height=6, width=9)

10.3 5-10 cm 5 minutes

method_5_2 <- mean_se_fx_5_2(c("treatment", "location", "x5wsa2000", 
                          "x5wsa250", "x5wsa53", "x5wsa20"),
                        c("x5wsa2000", "x5wsa250", "x5wsa53", "x5wsa20"),
                        c("8-2", "2-0.25", "0.25-0.053", "0.053-0.020"))

method_5_2$location_f =factor(method_5_2$location, levels=c('Tribune', 'Hays', 'Manhattan'))

method5min10cm <- merge(method_5_2, x5minx10, by=c("location", "treatment", "aggregate_size"))

ggplot(data=method5min10cm, aes(x=aggregate_size, y=mean_data, fill = treatment)) + 
  geom_bar(position=position_dodge(), stat="identity", colour = "black") +
  geom_errorbar(aes(ymin=mean_data-standard_error, ymax=mean_data+standard_error),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9)) + ylab("Mean value") + 
  scale_y_continuous(limits=c(0,80)) +  facet_wrap(facets=vars(location_f), strip.position="bottom")  + 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        legend.position="top",
        panel.border = element_rect(colour = "black", fill=NA, size=0.5),
        strip.background=element_rect(size=0.5, colour = "black"),
        axis.text.x=element_text(colour="black", size=10)) + xlab("Aggregate size fractions (mm)") + 
  ylab(expression(g ~100 ~g^{-1} ~soil)) +
  ggtitle("5 Minute Aggregate Fractions in 5-10 cm Depth") + 
  scale_fill_manual(values = colsnp) + 
  theme_James()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
  geom_text(aes(label=.group, y=mean_data + standard_error + 3), position = position_dodge(0.9), vjust=0) 

#+ ggsave("5min5-10cm.png",  height=6, width=9)

10.4 10-15 cm 5 minutes

method_5_3 <- mean_se_fx_5_3(c("treatment", "location", "x5wsa2000", 
                          "x5wsa250", "x5wsa53", "x5wsa20"),
                        c("x5wsa2000", "x5wsa250", "x5wsa53", "x5wsa20"),
                        c("8-2", "2-0.25", "0.25-0.053", "0.053-0.020"))

method_5_3$location_f =factor(method_5_3$location, levels=c('Tribune', 'Hays', 'Manhattan'))

method5min15cm <- merge(method_5_3, x5minx15, by=c("location", "treatment", "aggregate_size"))


ggplot(data=method5min15cm, aes(x=aggregate_size, y=mean_data, fill = treatment)) + 
  geom_bar(position=position_dodge(), stat="identity", colour = "black") +
  geom_errorbar(aes(ymin=mean_data-standard_error, ymax=mean_data+standard_error),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9)) + ylab("Mean value") + 
  scale_y_continuous(limits=c(0,80)) +  facet_wrap(facets=vars(location_f), strip.position="bottom")  + 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        legend.position="top",
        panel.border = element_rect(colour = "black", fill=NA, size=0.5),
        strip.background=element_rect(size=0.5, colour = "black"),
        axis.text.x=element_text(colour="black", size=10)) + xlab("Aggregate size fractions (mm)") + 
  ylab(expression(g ~100 ~g^{-1} ~soil)) +
  ggtitle("5 Minute Aggregate Fractions in 10-15 cm Depth") + 
  scale_fill_manual(values = colsnp) + 
  theme_James()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
  geom_text(aes(label=.group, y=mean_data + standard_error + 3), position = position_dodge(0.9), vjust=0) 

#+ ggsave("5min10_15cm.png",  height=6, width=9)

10.5 15-25 cm 5 minutes

method_5_4 <- mean_se_fx_5_4(c("treatment", "location", "x5wsa2000", 
                          "x5wsa250", "x5wsa53", "x5wsa20"),
                        c("x5wsa2000", "x5wsa250", "x5wsa53", "x5wsa20"),
                        c("8-2", "2-0.25", "0.25-0.053", "0.053-0.020"))

method_5_4$location_f =factor(method_5_4$location, levels=c('Tribune', 'Hays', 'Manhattan'))


ggplot(data=method_5_4, aes(x=aggregate_size, y=mean_data, fill = treatment)) + 
  geom_bar(position=position_dodge(), stat="identity", colour = "black") +
  geom_errorbar(aes(ymin=mean_data-standard_error, ymax=mean_data+standard_error),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9)) + ylab("Mean value") + 
  scale_y_continuous(limits=c(0,80)) +  facet_wrap(facets=vars(location_f), strip.position="bottom")  + 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        legend.position="top",
        panel.border = element_rect(colour = "black", fill=NA, size=0.5),
        strip.background=element_rect(size=0.5, colour = "black"),
        axis.text.x=element_text(colour="black", size=10)) + xlab("Aggregate size fractions (mm)") + 
  ylab(expression(g ~100 ~g^{-1} ~soil)) +
  ggtitle("5 Minute Aggregate Fractions in 15-25 cm Depth") + 
  scale_fill_manual(values = colsnp) + 
  theme_James()+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))

#Final dataframes

x20minx5
##    precip  location treatment     lsmean .group xloc aggregate_size
## 1     579      Hays        AG  0.9315208      b   .7            8-2
## 2     472   Tribune        AG  8.7304187      b   .7            8-2
## 3     850 Manhattan        AG  1.9782694      b   .7            8-2
## 4     472   Tribune        EA  8.8448459      b    1            8-2
## 5     579      Hays        EA  9.3305850      b    1            8-2
## 6     850 Manhattan        EA 11.4886335      b    1            8-2
## 7     472   Tribune        NP 26.3313434     a   1.3            8-2
## 8     850 Manhattan        NP 25.3077401     a   1.3            8-2
## 9     579      Hays        NP 30.8387700     a   1.3            8-2
## 10    579      Hays        AG 11.9734301      b  1.7         2-0.25
## 11    472   Tribune        AG 14.4454999      b  1.7         2-0.25
## 12    850 Manhattan        AG 17.6278247      c  1.7         2-0.25
## 13    472   Tribune        EA 16.2781993      b    2         2-0.25
## 14    579      Hays        EA 22.0219300     a     2         2-0.25
## 15    850 Manhattan        EA 24.9732871     b     2         2-0.25
## 16    472   Tribune        NP 25.6052664     a   2.3         2-0.25
## 17    850 Manhattan        NP 37.2452781    a    2.3         2-0.25
## 18    579      Hays        NP 28.5391700     a   2.3         2-0.25
## 19    472   Tribune        AG 53.0739889     a   2.7     0.25-0.053
## 20    850 Manhattan        AG 61.1650379    a    2.7     0.25-0.053
## 21    579      Hays        AG 69.7972833    a    2.7     0.25-0.053
## 22    472   Tribune        EA 49.1307814     a     3     0.25-0.053
## 23    579      Hays        EA 47.9366450     b     3     0.25-0.053
## 24    850 Manhattan        EA 47.3814008     b     3     0.25-0.053
## 25    579      Hays        NP 14.9092950      c  3.3     0.25-0.053
## 26    472   Tribune        NP 22.2972642      b  3.3     0.25-0.053
## 27    850 Manhattan        NP 16.5634973      c  3.3     0.25-0.053
## 28    472   Tribune        AG  6.1575000     a   3.7    0.053-0.020
## 29    850 Manhattan        AG  7.2450000     a   3.7    0.053-0.020
## 30    579      Hays        AG  5.2825000     a   3.7    0.053-0.020
## 31    472   Tribune        EA  3.9900000     ab    4    0.053-0.020
## 32    579      Hays        EA  3.3750000     a     4    0.053-0.020
## 33    850 Manhattan        EA  5.1450000     a     4    0.053-0.020
## 34    579      Hays        NP  1.0475000      b  4.3    0.053-0.020
## 35    472   Tribune        NP  1.9500000      b  4.3    0.053-0.020
## 36    850 Manhattan        NP  1.9325000      b  4.3    0.053-0.020
x20minx10
##    precip  location treatment    lsmean .group xloc aggregate_size
## 1     472   Tribune        AG  7.158672      b   .7            8-2
## 2     850 Manhattan        AG  3.003322      b   .7            8-2
## 3     579      Hays        AG  1.369402      b   .7            8-2
## 4     472   Tribune        EA  2.303734      b    1            8-2
## 5     850 Manhattan        EA  8.197339      b    1            8-2
## 6     579      Hays        EA  4.312530      b    1            8-2
## 7     472   Tribune        NP 19.874634     a   1.3            8-2
## 8     850 Manhattan        NP 19.539639     a   1.3            8-2
## 9     579      Hays        NP 27.933098     a   1.3            8-2
## 10    472   Tribune        AG 31.380248     a   1.7         2-0.25
## 11    579      Hays        AG 12.446052      b  1.7         2-0.25
## 12    850 Manhattan        AG 19.009357      b  1.7         2-0.25
## 13    579      Hays        EA 29.768317     a     2         2-0.25
## 14    472   Tribune        EA 15.885406      b    2         2-0.25
## 15    850 Manhattan        EA 31.988045     ab    2         2-0.25
## 16    472   Tribune        NP 33.762260     a   2.3         2-0.25
## 17    850 Manhattan        NP 35.211923     a   2.3         2-0.25
## 18    579      Hays        NP 22.881412     ab  2.3         2-0.25
## 19    472   Tribune        AG 40.252754     b   2.7     0.25-0.053
## 20    850 Manhattan        AG 60.480425    a    2.7     0.25-0.053
## 21    579      Hays        AG 61.041555    a    2.7     0.25-0.053
## 22    472   Tribune        EA 60.538628    a      3     0.25-0.053
## 23    850 Manhattan        EA 45.043383     b     3     0.25-0.053
## 24    579      Hays        EA 47.547415     b     3     0.25-0.053
## 25    579      Hays        NP 28.361588      c  3.3     0.25-0.053
## 26    472   Tribune        NP 24.336891      c  3.3     0.25-0.053
## 27    850 Manhattan        NP 23.599879      c  3.3     0.25-0.053
## 28    472   Tribune        AG  4.107500     ab  3.7    0.053-0.020
## 29    579      Hays        AG  8.777500    a    3.7    0.053-0.020
## 30    850 Manhattan        AG  4.812500     ab  3.7    0.053-0.020
## 31    472   Tribune        EA  5.410000     a     4    0.053-0.020
## 32    850 Manhattan        EA  5.047500     a     4    0.053-0.020
## 33    579      Hays        EA  3.777500     b     4    0.053-0.020
## 34    579      Hays        NP  1.757500      c  4.3    0.053-0.020
## 35    472   Tribune        NP  2.182500      b  4.3    0.053-0.020
## 36    850 Manhattan        NP  3.040000      b  4.3    0.053-0.020
x20minx15
##    precip  location treatment    lsmean .group xloc aggregate_size
## 1     472   Tribune        AG  7.344079      b   .7            8-2
## 2     850 Manhattan        AG  2.653159      b   .7            8-2
## 3     579      Hays        AG  1.931631      b   .7            8-2
## 4     472   Tribune        EA  3.058975      b    1            8-2
## 5     850 Manhattan        EA  4.378598      b    1            8-2
## 6     579      Hays        EA  2.561610      b    1            8-2
## 7     472   Tribune        NP 26.297002     a   1.3            8-2
## 8     850 Manhattan        NP 25.368150     a   1.3            8-2
## 9     579      Hays        NP 23.871558     a   1.3            8-2
## 10    472   Tribune        AG 27.333662     ab  1.7         2-0.25
## 11    579      Hays        AG 32.940850      a  1.7         2-0.25
## 12    850 Manhattan        AG 29.494218      a  1.7         2-0.25
## 13    579      Hays        EA 18.866673      a    2         2-0.25
## 14    472   Tribune        EA 15.882277      b    2         2-0.25
## 15    850 Manhattan        EA 25.795000      a    2         2-0.25
## 16    472   Tribune        NP 31.521145     a   2.3         2-0.25
## 17    850 Manhattan        NP 37.563085      a  2.3         2-0.25
## 18    579      Hays        NP 23.263343      a  2.3         2-0.25
## 19    472   Tribune        AG 43.855421     a   2.7     0.25-0.053
## 20    850 Manhattan        AG 54.041827     a   2.7     0.25-0.053
## 21    579      Hays        AG 44.035286      b  2.7     0.25-0.053
## 22    472   Tribune        EA 51.129566     a     3     0.25-0.053
## 23    579      Hays        EA 59.985325     a     3     0.25-0.053
## 24    850 Manhattan        EA 52.365267     a     3     0.25-0.053
## 25    579      Hays        NP 32.689282      b  3.3     0.25-0.053
## 26    472   Tribune        NP 20.873743      b  3.3     0.25-0.053
## 27    850 Manhattan        NP 19.454231      b  3.3     0.25-0.053
## 28    472   Tribune        AG  4.412500      b  3.7    0.053-0.020
## 29    579      Hays        AG  7.827500     a   3.7    0.053-0.020
## 30    850 Manhattan        AG  3.470000      b  3.7    0.053-0.020
## 31    472   Tribune        EA  8.422500     a     4    0.053-0.020
## 32    850 Manhattan        EA  6.940000     a     4    0.053-0.020
## 33    579      Hays        EA  5.562500     a     4    0.053-0.020
## 34    579      Hays        NP  2.440000      b  4.3    0.053-0.020
## 35    472   Tribune        NP  1.615000      b  4.3    0.053-0.020
## 36    850 Manhattan        NP  1.732500      b  4.3    0.053-0.020
x5minx5
##    precip  location treatment    lsmean .group xloc aggregate_size
## 1     579      Hays        AG  1.563937      c   .7            8-2
## 2     472   Tribune        AG  6.619284      a   .7            8-2
## 3     850 Manhattan        AG  2.857780      c   .7            8-2
## 4     472   Tribune        EA 10.186894      a    1            8-2
## 5     850 Manhattan        EA 14.241278     b     1            8-2
## 6     579      Hays        EA 25.901540     b     1            8-2
## 7     472   Tribune        NP  8.822787      a  1.3            8-2
## 8     850 Manhattan        NP 25.434619    a    1.3            8-2
## 9     579      Hays        NP 44.065476    a    1.3            8-2
## 10    579      Hays        AG 27.649027      a  1.7         2-0.25
## 11    472   Tribune        AG  9.931781      b  1.7         2-0.25
## 12    850 Manhattan        AG 28.049438      b  1.7         2-0.25
## 13    472   Tribune        EA 29.018520     a     2         2-0.25
## 14    579      Hays        EA 26.595305      a    2         2-0.25
## 15    850 Manhattan        EA 31.323713      b    2         2-0.25
## 16    850 Manhattan        NP 44.262281     a   2.3         2-0.25
## 17    472   Tribune        NP 27.005202     a   2.3         2-0.25
## 18    579      Hays        NP 32.570016      a  2.3         2-0.25
## 19    472   Tribune        AG 51.284628     a   2.7     0.25-0.053
## 20    850 Manhattan        AG 52.782708    a    2.7     0.25-0.053
## 21    579      Hays        AG 46.220153     a   2.7     0.25-0.053
## 22    472   Tribune        EA 35.120163      b    3     0.25-0.053
## 23    579      Hays        EA 39.818455     a     3     0.25-0.053
## 24    850 Manhattan        EA 30.859602     b     3     0.25-0.053
## 25    579      Hays        NP 18.923355      b  3.3     0.25-0.053
## 26    472   Tribune        NP 23.414279      b  3.3     0.25-0.053
## 27    850 Manhattan        NP 12.952119      c  3.3     0.25-0.053
## 28    472   Tribune        AG  6.822500      a  3.7    0.053-0.020
## 29    579      Hays        AG  6.052500      b  3.7    0.053-0.020
## 30    850 Manhattan        AG  3.980000      a  3.7    0.053-0.020
## 31    579      Hays        EA 16.817500     a     4    0.053-0.020
## 32    472   Tribune        EA  4.965000      a    4    0.053-0.020
## 33    850 Manhattan        EA  3.775000      a    4    0.053-0.020
## 34    579      Hays        NP  8.617500      b  4.3    0.053-0.020
## 35    472   Tribune        NP  5.255000      a  4.3    0.053-0.020
## 36    850 Manhattan        NP  1.433954      a  4.3    0.053-0.020
x5minx10
##    precip  location treatment    lsmean .group xloc aggregate_size
## 1     472   Tribune        AG  7.358129      a   .7            8-2
## 2     850 Manhattan        AG  4.704605      c   .7            8-2
## 3     579      Hays        AG  3.551578      c   .7            8-2
## 4     472   Tribune        EA  3.989024      a    1            8-2
## 5     850 Manhattan        EA 18.601440     b     1            8-2
## 6     579      Hays        EA 10.999532     b     1            8-2
## 7     472   Tribune        NP  7.784108      a  1.3            8-2
## 8     850 Manhattan        NP 27.719093    a    1.3            8-2
## 9     579      Hays        NP 47.950775    a    1.3            8-2
## 10    579      Hays        AG 16.110140      b  1.7         2-0.25
## 11    472   Tribune        AG 15.926345      b  1.7         2-0.25
## 12    850 Manhattan        AG 41.277747      a  1.7         2-0.25
## 13    472   Tribune        EA 17.127007      b    2         2-0.25
## 14    579      Hays        EA 38.088665     a     2         2-0.25
## 15    850 Manhattan        EA 37.566067      a    2         2-0.25
## 16    472   Tribune        NP 36.000295     a   2.3         2-0.25
## 17    850 Manhattan        NP 44.207087      a  2.3         2-0.25
## 18    579      Hays        NP 37.440809     a   2.3         2-0.25
## 19    472   Tribune        AG 48.790371     a   2.7     0.25-0.053
## 20    850 Manhattan        AG 42.544111     a   2.7     0.25-0.053
## 21    579      Hays        AG 53.844274     a   2.7     0.25-0.053
## 22    472   Tribune        EA 56.268022     a     3     0.25-0.053
## 23    850 Manhattan        EA 23.878426      b    3     0.25-0.053
## 24    579      Hays        EA 52.739372     a     3     0.25-0.053
## 25    579      Hays        NP 26.004243      b  3.3     0.25-0.053
## 26    472   Tribune        NP 28.543049      b  3.3     0.25-0.053
## 27    850 Manhattan        NP 12.828371      b  3.3     0.25-0.053
## 28    472   Tribune        AG  7.580000      a  3.7    0.053-0.020
## 29    579      Hays        AG  5.632500      b  3.7    0.053-0.020
## 30    850 Manhattan        AG  2.252500      a  3.7    0.053-0.020
## 31    850 Manhattan        EA  4.247500      a    4    0.053-0.020
## 32    472   Tribune        EA  6.502500      a    4    0.053-0.020
## 33    579      Hays        EA 11.552500     a     4    0.053-0.020
## 34    579      Hays        NP  9.017500     a   4.3    0.053-0.020
## 35    472   Tribune        NP  4.895000      a  4.3    0.053-0.020
## 36    850 Manhattan        NP  1.715000      a  4.3    0.053-0.020
x5minx15
##    precip  location treatment    lsmean .group xloc aggregate_size
## 1     472   Tribune        AG  6.606750      a   .7            8-2
## 2     579      Hays        AG 11.637256      b   .7            8-2
## 3     850 Manhattan        AG  4.467970      b   .7            8-2
## 4     579      Hays        EA  7.687615      b    1            8-2
## 5     472   Tribune        EA  6.572290      a    1            8-2
## 6     850 Manhattan        EA 15.118422     ab    1            8-2
## 7     472   Tribune        NP 14.583834      a  1.3            8-2
## 8     850 Manhattan        NP 26.750084     a   1.3            8-2
## 9     579      Hays        NP 40.495560     a   1.3            8-2
## 10    472   Tribune        AG 19.599914      a  1.7         2-0.25
## 11    850 Manhattan        AG 52.686735      a  1.7         2-0.25
## 12    579      Hays        AG 32.008450      a  1.7         2-0.25
## 13    472   Tribune        EA 32.715244      a    2         2-0.25
## 14    579      Hays        EA 45.464665      a    2         2-0.25
## 15    850 Manhattan        EA 36.017346      a    2         2-0.25
## 16    472   Tribune        NP 18.032457      a  2.3         2-0.25
## 17    850 Manhattan        NP 37.692543      a  2.3         2-0.25
## 18    579      Hays        NP 32.094026      a  2.3         2-0.25
## 19    472   Tribune        AG 54.061937     a   2.7     0.25-0.053
## 20    850 Manhattan        AG 33.095686      a  2.7     0.25-0.053
## 21    579      Hays        AG 32.267456      b  2.7     0.25-0.053
## 22    472   Tribune        EA 41.100643     ab    3     0.25-0.053
## 23    579      Hays        EA 49.596737     a     3     0.25-0.053
## 24    850 Manhattan        EA 29.540473      a    3     0.25-0.053
## 25    579      Hays        NP 26.417570      b  3.3     0.25-0.053
## 26    472   Tribune        NP 33.014734      b  3.3     0.25-0.053
## 27    850 Manhattan        NP 20.066238      a  3.3     0.25-0.053
## 28    472   Tribune        AG  5.557500      a  3.7    0.053-0.020
## 29    579      Hays        AG  5.852500      b  3.7    0.053-0.020
## 30    850 Manhattan        AG  3.072500     ab  3.7    0.053-0.020
## 31    472   Tribune        EA  5.675000      a    4    0.053-0.020
## 32    850 Manhattan        EA  4.202500     a     4    0.053-0.020
## 33    579      Hays        EA 10.870000     a     4    0.053-0.020
## 34    579      Hays        NP  8.927500     a   4.3    0.053-0.020
## 35    472   Tribune        NP  5.085000      a  4.3    0.053-0.020
## 36    850 Manhattan        NP  1.410000      b  4.3    0.053-0.020

11 NRCS Aggregate Graphs

11.1 Aggregate function

#function to calculate the mean and standard error

#0-5 cm
mean_se_fx_n_1 <- function(select_variable, aggregate_size, aggregate_size_conversion){
  subset_data <- agg1[, select_variable]
  subset_data_1 <- gather(subset_data, aggregate_size , value, - treatment, - location)
  subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size, 
                                         levels = aggregate_size)
  subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size, 
                                                  from=aggregate_size, to=aggregate_size_conversion)
  se <- function(x, na.rm=TRUE) {
    if (na.rm) x <- na.omit(x)
    sqrt(var(x)/length(x))
  }
  subset_data_2 <- subset_data_1 %>% group_by(location, treatment, aggregate_size) %>%
    summarize(mean_data = mean(value, na.rm = TRUE), standard_error = se(value))
    #Reposition location labels
  subset_data_2$location <- factor(subset_data_2$location, levels = c("Tribune", "Hays", "Manhattan")) 
  return(subset_data_2)
}

#5-10 cm
mean_se_fx_n_2 <- function(select_variable, aggregate_size, aggregate_size_conversion){
  subset_data <- agg2[, select_variable]
  subset_data_1 <- gather(subset_data, aggregate_size , value, - treatment, - location)
  subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size, 
                                         levels = aggregate_size)
  subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size, 
                                                  from=aggregate_size, to=aggregate_size_conversion)
  se <- function(x, na.rm=TRUE) {
    if (na.rm) x <- na.omit(x)
    sqrt(var(x)/length(x))
  }
  subset_data_2 <- subset_data_1 %>% group_by(location, treatment, aggregate_size) %>%
    summarize(mean_data = mean(value, na.rm = TRUE), standard_error = se(value))
    #Reposition location labels
  subset_data_2$location <- factor(subset_data_2$location, levels = c("Tribune", "Hays", "Manhattan")) 
  return(subset_data_2)
}

#10-15 cm
mean_se_fx_n_3 <- function(select_variable, aggregate_size, aggregate_size_conversion){
  subset_data <- agg3[, select_variable]
  subset_data_1 <- gather(subset_data, aggregate_size , value, - treatment, - location)
  subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size, 
                                         levels = aggregate_size)
  subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size, 
                                                  from=aggregate_size, to=aggregate_size_conversion)
  se <- function(x, na.rm=TRUE) {
    if (na.rm) x <- na.omit(x)
    sqrt(var(x)/length(x))
  }
  subset_data_2 <- subset_data_1 %>% group_by(location, treatment, aggregate_size) %>%
    summarize(mean_data = mean(value, na.rm = TRUE), standard_error = se(value))
    #Reposition location labels
  subset_data_2$location <- factor(subset_data_2$location, levels = c("Tribune", "Hays", "Manhattan")) 
  return(subset_data_2)
}

#15- 25 or 40 cm
mean_se_fx_n_4 <- function(select_variable, aggregate_size, aggregate_size_conversion){
  subset_data <- agg4[, select_variable]
  subset_data_1 <- gather(subset_data, aggregate_size , value, - treatment, - location)
  subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size, 
                                         levels = aggregate_size)
  subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size, 
                                                  from=aggregate_size, to=aggregate_size_conversion)
  se <- function(x, na.rm=TRUE) {
    if (na.rm) x <- na.omit(x)
    sqrt(var(x)/length(x))
  }
  subset_data_2 <- subset_data_1 %>% group_by(location, treatment, aggregate_size) %>%
    summarize(mean_data = mean(value, na.rm = TRUE), standard_error = se(value))
    #Reposition location labels
  subset_data_2$location <- factor(subset_data_2$location, levels = c("Tribune", "Hays", "Manhattan")) 
  return(subset_data_2)
}

#the color palette for the Treatments
colsnp <- c( "AG" = "black", "EA" = "grey40", "NP" = "grey90")

11.2 0-5 cm NRCS

method_n_1 <- mean_se_fx_n_1(c("treatment", "location", "nagg"),
                        c("nagg"),
                        c(""))


method_n_1$location_f =factor(method_n_1$location, levels=c('Tribune', 'Hays', 'Manhattan'))

methodnagg5cm <- merge(method_n_1, naggp, by=c("location", "treatment", "location_f"))



ggplot(data=methodnagg5cm, aes(x=aggregate_size, y=mean_data, fill = treatment)) + 
  geom_bar(position=position_dodge(), stat="identity", colour = "black") +
  geom_errorbar(aes(ymin=mean_data-standard_error, ymax=mean_data+standard_error),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9)) + ylab("Mean value") + 
  scale_y_continuous(limits=c(0,90)) +  facet_wrap(facets=vars(location_f), strip.position="bottom")  + 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        legend.position="top",
        panel.border = element_rect(colour = "black", fill=NA, size=0.5),
        strip.background=element_rect(size=0.5, colour = "black"),
        axis.text.x=element_text(colour="black", size=10)) + xlab("% aggregate between 2 mm to 0.25 mm size fraction") + 
        ylab("Aggregate Retained (%)") +
  ggtitle("NRCS Aggregate Fractions in 0-5 cm Depth") + 
  scale_fill_manual(values = colsnp) + 
  theme_James() +
  geom_text(aes(label=.group, y=mean_data + standard_error + 3), position = position_dodge(0.9), vjust=0) 

#+ ggsave("nagg5cm.png",  height=6, width=9)

11.3 5-10 cm NRCS

method_n_2 <- mean_se_fx_n_2(c("treatment", "location", "nagg"),
                        c("nagg"),
                        c(""))

method_n_2$location_f =factor(method_n_2$location, levels=c('Tribune', 'Hays', 'Manhattan'))

methodnagg10cm <- merge(method_n_2, nagg10p, by=c("location", "treatment", "location_f"))


ggplot(data=methodnagg10cm, aes(x=aggregate_size, y=mean_data, fill = treatment)) + 
  geom_bar(position=position_dodge(), stat="identity", colour = "black") +
  geom_errorbar(aes(ymin=mean_data-standard_error, ymax=mean_data+standard_error),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9)) + ylab("Mean value") + 
  scale_y_continuous(limits=c(0,80)) +  facet_wrap(facets=vars(location_f), strip.position="bottom")  + 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        legend.position="top",
        panel.border = element_rect(colour = "black", fill=NA, size=0.5),
        strip.background=element_rect(size=0.5, colour = "black"),
        axis.text.x=element_text(colour="black", size=10)) + xlab("% aggregate between 2 mm to 0.25 mm size fraction") + 
        ylab("Aggregate Retained (%)") +
  ggtitle("NRCS Aggregate Fractions in 5-10 cm Depth") + 
  scale_fill_manual(values = colsnp) + 
  theme_James() +
  geom_text(aes(label=.group, y=mean_data + standard_error + 3), position = position_dodge(0.9), vjust=0) 

#+ ggsave("nagg10cm.png",  height=6, width=9)

11.4 10-15 cm NRCS

method_n_3 <- mean_se_fx_n_3(c("treatment", "location", "nagg"),
                        c("nagg"),
                        c(""))

method_n_3$location_f =factor(method_n_3$location, levels=c('Tribune', 'Hays', 'Manhattan'))

methodnagg15cm <- merge(method_n_3, nagg15p, by=c("location", "treatment", "location_f"))

ggplot(data=methodnagg15cm, aes(x=aggregate_size, y=mean_data, fill = treatment)) + 
  geom_bar(position=position_dodge(), stat="identity", colour = "black") +
  geom_errorbar(aes(ymin=mean_data-standard_error, ymax=mean_data+standard_error),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9)) + ylab("Mean value") + 
  scale_y_continuous(limits=c(0,80)) +  facet_wrap(facets=vars(location_f), strip.position="bottom")  + 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        legend.position="top",
        panel.border = element_rect(colour = "black", fill=NA, size=0.5),
        strip.background=element_rect(size=0.5, colour = "black"),
       axis.text.x=element_text(colour="black", size=10)) + xlab("% aggregate between 2 mm to 0.25 mm size fraction") + 
        ylab("Aggregate Retained (%)") +
  ggtitle("NRCS Aggregate Fractions in 10-15 cm Depth") +
  scale_fill_manual(values = colsnp) + 
  theme_James() +
  geom_text(aes(label=.group, y=mean_data + standard_error + 3), position = position_dodge(0.9), vjust=0)

#+ ggsave("nagg15cm.png",  height=6, width=9)

11.5 15-25 cm NRCS

method_n_4 <- mean_se_fx_n_4(c("treatment", "location", "nagg"),
                        c("nagg"),
                        c(""))

method_n_4$location_f =factor(method_n_4$location, levels=c('Tribune', 'Hays', 'Manhattan'))


ggplot(data=method_n_4, aes(x=aggregate_size, y=mean_data, fill = treatment)) + 
  geom_bar(position=position_dodge(), stat="identity", colour = "black") +
  geom_errorbar(aes(ymin=mean_data-standard_error, ymax=mean_data+standard_error),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9)) + ylab("Mean value") + 
  scale_y_continuous(limits=c(0,80)) +  facet_wrap(facets=vars(location_f), strip.position="bottom")  + 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        legend.position="top",
        panel.border = element_rect(colour = "black", fill=NA, size=0.5),
        strip.background=element_rect(size=0.5, colour = "black"),
        axis.text.x=element_text(colour="black", size=10)) + xlab("% aggregate between 2 mm to 0.25 mm size fraction") + 
        ylab("Aggregate Retained (%)") +
  ggtitle("NRCS Aggregate Fractions in 15-25 cm Depth") +
  scale_fill_manual(values = colsnp) + 
  theme_James()

#20 and 5 minute MWD

11.6 0-5 cm 5 minutes

method_n_1 <- mean_se_fx_n_1(c("treatment", "location", "nagg"),
                        c("nagg"),
                        c(""))


method_n_1$location_f =factor(method_n_1$location, levels=c('Tribune', 'Hays', 'Manhattan'))

methodnagg5cm <- merge(method_n_1, naggp, by=c("location", "treatment", "location_f"))

ggplot(data=methodnagg5cm, aes(x=aggregate_size, y=mean_data, fill = treatment)) + 
  geom_bar(position=position_dodge(), stat="identity", colour = "black") +
  geom_errorbar(aes(ymin=mean_data-standard_error, ymax=mean_data+standard_error),
                width=.2,                    # Width of the error bars
                position=position_dodge(.9)) + ylab("Mean value") + 
  scale_y_continuous(limits=c(0,90)) +  facet_wrap(facets=vars(location_f), strip.position="bottom")  + 
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        panel.background = element_blank(), axis.line = element_line(colour = "black"),
        legend.position="top",
        panel.border = element_rect(colour = "black", fill=NA, size=0.5),
        strip.background=element_rect(size=0.5, colour = "black"),
        axis.text.x=element_text(colour="black", size=10)) + xlab("% aggregate between 2 mm to 0.25 mm size fraction") + 
        ylab("Aggregate Retained (%)") +
  ggtitle("NRCS Aggregate Fractions in 0-5 cm Depth") + 
  scale_fill_manual(values = colsnp) + 
  theme_James() +
  geom_text(aes(label=.group, y=mean_data + standard_error + 3), position = position_dodge(0.9), vjust=0) 

#+ ggsave("nagg5cm.png",  height=6, width=9)

12 Methods Comparison

12.1 Data Manipulation

#remove Ottawa and irrigation dataset since 5MWD isnt available
# data frame for (20 minutes vs 5 minutes) & (5 minutes vs NRCS)- only has 4 horizons
soils <- agg %>%
  filter(location!="Ottawa", treatment!="IR") %>%
  na.omit()

soils$location_a =factor(soils$location, levels=c('Tribune', 'Hays', 'Manhattan'))

soils$horizon_a =factor(soils$horizon, levels=c('1', '2', '3', '4'))


# data frame for 20 minutes vs NRCS- has all horizons
soils_b <- agg %>%
  dplyr::select(-x5mwd, -x5wsa2000, -x5wsa250, -x5wsa53, -x5wsa20) %>%
  dplyr::filter(location!="Ottawa", treatment!="IR") %>%
  na.omit()

soils_b$location_b =factor(soils_b$location, levels=c('Tribune', 'Hays', 'Manhattan'))

soils_b$horizon_b =factor(soils_b$horizon, levels=c('1', '2', '3', '4', '5', '6', '7'))

12.2 20mwd and 5mwd Correlation graphs

use soils data frame and location_a and horizon_a

#20 minute Mean Weight Diameter vs 5 minute Method

soils %>%
ggplot(aes(x=x20mwd, y= x5mwd))+
  geom_point(size=.5)+
  labs(x="20 Minute Method (mm)", 
       y="5 Minute Method (mm)",
       title="Correlation between 20 vs 5 minute MWD") +
  theme_bw(base_size=12, base_family='TT Times New Roman')+
  geom_smooth(method="lm", se=FALSE)+
   theme(panel.grid.major = element_blank(),
         panel.grid.minor = element_blank()) +
  theme_James() +
  stat_cor(aes(label = paste(..rr.label..,  sep = "~`,`~")), method="spearman", na.rm=F, label.x=.1, label.y=3.4,  p.accuracy = 0.001, show.legend = F) +
  stat_regline_equation(label.y=3)

#cor(soils$x20mwd, soils$x5mwd, method="spearman", use="complete.obs")

#One graph by location

soils %>%
ggplot(aes(x=x20mwd, y= x5mwd, color=location_a, shape=location_a))+
  geom_point(size=1)+
  labs(x="20 Minute Method (mm)", 
       y="5 Minute Method (mm)",
       title="Correlation between 20 vs 5 minute MWD") +
  theme_classic()+
  geom_smooth(method="lm", se=FALSE)+
  theme_James() +
   stat_cor(aes(color=location_a, label = paste(..rr.label.., sep = "~`,`~")), method="spearman", na.rm=F, label.x=.01,  p.accuracy = 0.001, show.legend = F) +
  stat_regline_equation(label.x=.5, show.legend = F)

#group by location

soils %>%
ggplot(aes(x=x20mwd, y= x5mwd))+
  facet_wrap(~location_a)+
  labs(x="20 Minute Method (mm)", 
       y="5 Minute Method (mm)",
       title="Correlation between 20 vs 5 minute MWD by Location") +
  theme_classic()+
  geom_smooth(method="lm", se=FALSE, color= "black") +
 geom_point(size=.5)+
  theme_James() +
     stat_cor(aes(color=location_a, label = paste(..rr.label.., sep = "~`,`~")), method="spearman", na.rm=F, label.y=.01,  p.accuracy = 0.001,  show.legend = F) +
  stat_regline_equation(label.x=.5, show.legend = F)

# just to find p value for tribune 

soils %>%
ggplot(aes(x=x20mwd, y= x5mwd))+
  facet_wrap(~location_a)+
  labs(x="20 Minute Method (mm)", 
       y="5 Minute Method (mm)",
       title="Correlation between 20 vs 5 minute MWD by Location") +
  theme_classic()+
  geom_smooth(method="lm", se=FALSE, color= "black") +
 geom_point(size=.5)+
  theme_James() +
     stat_cor(aes(color=location_a, label = paste(..rr.label.., sep = "~`,`~")), method="spearman", na.rm=F, label.y=.01,  show.legend = F)+
  stat_regline_equation(label.x=.5, show.legend = F)

### Correlation plots for group depths

#20 minute Mean Weight Diameter vs 5 minute Method
#group by location



soils %>%
ggplot(aes(x=x20mwd, y= x5mwd, color=treatment))+
  facet_wrap(~location_a)+
  labs(x="20 Minute Method (mm)", 
       y="5 Minute Method (mm)",
       title="Correlation between 20 vs 5 minute MWD by Location", shape="Horizon", color="Treatment") +
   scale_y_continuous(limits=c(0,5)) +
  theme_classic()+
 geom_point(size=2)+
  theme_James2()+ 
    stat_cor(aes(label = paste(..r.label..,..rr.label.., ..p.label.., sep = "~`,`~")), method="spearman", na.rm=F,  p.accuracy = 0.001, show.legend = F)

#Has correlation by treatment by location
soils %>%
ggplot(aes(x=x20mwd, y= x5mwd, color=treatment))+
  facet_wrap(~location_a)+
     stat_cor(aes(label = paste(..rr.label.., sep = "~`,`~")), method="spearman", na.rm=F,  p.accuracy = 0.001, show.legend = F)+ labs(x="20 Minute Method (mm)", 
       y="5 Minute Method (mm)",
       title="Correlation between 20 vs 5 minute MWD by Location", shape="Horizon", color="Treatment") +
   scale_y_continuous(limits=c(0,5)) +
  theme_classic()+
  geom_point(size=2, aes(shape=horizon_a))+
  theme_James2() +
    stat_regline_equation(label.x=1.3, show.legend = F) 

   ggsave("20min5mincor.png",  height=6, width=9)



#Has correlation by treatment by location and has eclipses

soils %>%
ggplot(aes(x=x20mwd, y= x5mwd, color=treatment))+
  facet_wrap(~location_a)+
     stat_cor(aes(label = paste(..rr.label.., sep = "~`,`~")), method="spearman", na.rm=F,  p.accuracy = 0.001, show.legend = F)+ labs(x="20 Minute Method (mm)", 
       y="5 Minute Method (mm)",
       title="Correlation between 20 vs 5 minute MWD by Location", shape="Horizon", color="Treatment") +
   scale_y_continuous(limits=c(0,5)) +
  theme_classic()+
  geom_point(size=2, aes(shape=horizon_a))+
  theme_James2() +
geom_mark_ellipse(expand=0, aes(fill=treatment), show.legend = F)

12.3 20mwd and NRCS Correlation graphs

use soils_b data frame and location_b and horizon_b

#20 minute Mean Weight Diameter vs NRCS Hand Method

soils_b %>%
ggplot(aes(x=x20mwd, y= nagg))+
  geom_point(size=.5)+
  labs(x="20 minute method (mm)", 
       y="NRCS Hand Method (%)",
       title="Correlation between 20 Minute MWD vs NRCS") +
  theme_classic()+
  geom_smooth(method="lm", se=FALSE) +
  theme_James() +
  stat_cor(aes(label = paste(..rr.label.., sep = "~`,`~")), method="spearman", na.rm=F, label.x=.1, label.y=85,  p.accuracy = 0.001) +
    stat_regline_equation(label.y=75)

#One graph by location

soils_b %>%
ggplot(aes(x=x20mwd, y= nagg, color=location_b, shape=location_b))+
  geom_point(size=1)+
  labs(x="20 minute method (mm)", 
       y="NRCS Hand Method (%)",
       title="Correlation between 20 Minute MWD vs NRCS") +
  theme_classic()+
  geom_smooth(method="lm", se=FALSE) +
  theme_James() +
   stat_cor(aes(color=location_b, label = paste(..rr.label.., sep = "~`,`~")), method="spearman", na.rm=F, label.x=.01,  p.accuracy = 0.001, show.legend = F) +
    stat_regline_equation(label.x=.5, show.legend = F)

#group by location

soils_b %>%
ggplot(aes(x=x20mwd, y= nagg))+
  facet_wrap(~location_b)+
  labs(x="20 Minute Method (mm)", 
       y="NRCS Hand Method (%)",
       title="Correlation between 20 Minute MWD vs NRCS by Location") +
  theme_classic()+
  geom_smooth(method="lm", se=FALSE, color= "black") +
 geom_point(size=.5) +
  theme_James() +
     stat_cor(aes(color=location_b, label = paste(..rr.label.., sep = "~`,`~")), method="spearman", na.rm=F, label.y=.01,  p.accuracy = 0.001,  show.legend = F) +
    stat_regline_equation(label.x=.5, show.legend = F)

12.3.1 Correlation plots for group depths

#20 minute Mean Weight Diameter vs NRCS
#group by location



soils_b %>%
ggplot(aes(x=x20mwd, y= nagg, color=treatment))+
  facet_wrap(~location_b)+
  labs(x="20 Minute Method (mm)", 
       y="NRCS Hand Method (%)",
       title="Correlation between 20 Minute MWD vs NRCS by Location", shape="Horizon", color="Treatment") +
   scale_y_continuous(limits=c(0,100)) +
  theme_classic()+
 geom_point(size=2)+
  theme_James2()+ 
    stat_cor(aes(label = paste(..r.label..,..rr.label.., ..p.label.., sep = "~`,`~")), method="spearman", na.rm=F,  p.accuracy = 0.001, show.legend = F)

#Has correlation by treatment by location
soils_b %>%
ggplot(aes(x=x20mwd, y= nagg, color=treatment))+
  facet_wrap(~location_b)+
     stat_cor(aes(label = paste(..rr.label.., sep = "~`,`~")), method="spearman", na.rm=F,  p.accuracy = 0.001, show.legend = F)+ labs(x="20 Minute Method (mm)", 
       y="NRCS Hand Method (%)",
       title="Correlation between 20 Minute MWD vs NRCS by Location", shape="Horizon", color="Treatment") +
   scale_y_continuous(limits=c(0,100)) +
  theme_classic()+
  geom_point(size=2, aes(shape=horizon_b))+
      scale_shape_manual(values=c(19, 17, 15, 3, 7, 8, 10)) +
  theme_James2() +
      stat_regline_equation(label.x=1.3, show.legend = F) 

   ggsave("20minNRCScor.png",  height=6, width=9)



#Has correlation by treatment by location and has eclipses

soils_b %>%
ggplot(aes(x=x20mwd, y= nagg, color=treatment))+
  facet_wrap(~location_b)+
     stat_cor(aes(label = paste(..r.label..,..rr.label.., ..p.label.., sep = "~`,`~")), method="spearman", na.rm=F,  p.accuracy = 0.001, show.legend = F)+ labs(x="20 Minute Method (mm)", 
       y="NRCS Hand Method (%)",
       title="Correlation between 20 Minute MWD vs NRCS by Location", shape="Horizon", color="Treatment") +
   scale_y_continuous(limits=c(0,100)) +
  theme_classic()+
  geom_point(size=2, aes(shape=horizon_b), na.rm = T)+
    scale_shape_manual(values=c(19, 17, 15, 3, 7, 8, 10)) +
  theme_James2() +
geom_mark_ellipse(expand=0, aes(fill=treatment), show.legend = F)

12.4 NRCS and 5mwd Correlation graphs

use soils data frame and location_a and horizon_a

#NRCS vs 5 minute Method

soils %>%
ggplot(aes(x=nagg, y= x5mwd))+
  geom_point(size=.5)+
  labs(x="NRCS Hand Method (%)",
       y="5 Minute Method (mm)",
       title="Correlation between NRCS vs 5 minute MWD") +
  theme_bw(base_size=12, base_family='TT Times New Roman')+
  geom_smooth(method="lm", se=FALSE)+
   theme(panel.grid.major = element_blank(),
         panel.grid.minor = element_blank()) +
  theme_James() +
  stat_cor(aes(label = paste(..rr.label.., sep = "~`,`~")), method="spearman", na.rm=F, label.x=1, label.y=3.4,  p.accuracy = 0.001, show.legend = F) +
    stat_regline_equation(label.y=3)

#One graph by location

soils %>%
ggplot(aes(x=nagg, y= x5mwd, color=location_a, shape=location_a))+
  geom_point(size=1)+
  labs(x="NRCS Hand Method (%)", 
       y="5 Minute Method (mm)",
       title="Correlation between NRCS vs 5 minute MWD") +
  theme_classic()+
  geom_smooth(method="lm", se=FALSE)+
  theme_James() +
   stat_cor(aes(color=location_a, label = paste(..rr.label.., sep = "~`,`~")), method="spearman", na.rm=F, label.x=.01,  p.accuracy = 0.001, show.legend = F) +
    stat_regline_equation(label.x=15, show.legend = F)

#group by location

soils %>%
ggplot(aes(x=nagg, y= x5mwd))+
  facet_wrap(~location_a)+
  labs(x="NRCS Hand Method (%)", 
       y="5 Minute Method (mm)",
       title="Correlation between NRCS vs 5 minute MWD by Location") +
  theme_classic()+
  geom_smooth(method="lm", se=FALSE, color= "black") +
 geom_point(size=.5)+
  theme_James() +
     stat_cor(aes(color=location_a, label = paste(..rr.label.., sep = "~`,`~")), method="spearman", na.rm=F, label.y=.01,  p.accuracy = 0.001,  show.legend = F) +
    stat_regline_equation(label.x=.5, show.legend = F)

12.4.1 Correlation plots for group depths

#NRCS vs 5 minute Method
#group by location



soils %>%
ggplot(aes(x=nagg, y= x5mwd, color=treatment))+
  facet_wrap(~location_a)+
  labs(x="NRCS Hand Method (%)", 
       y="5 Minute Method (mm)",
       title="Correlation between NRCS vs 5 minute MWD by Location", shape="Horizon", color="Treatment") +
   scale_y_continuous(limits=c(0,5)) +
  theme_classic()+
 geom_point(size=2)+
  theme_James2()+ 
    stat_cor(aes(label = paste(..r.label..,..rr.label.., ..p.label.., sep = "~`,`~")), method="spearman", na.rm=F,  p.accuracy = 0.001, show.legend = F)

#Has correlation by treatment by location
soils %>%
ggplot(aes(x=nagg, y= x5mwd, color=treatment))+
  facet_wrap(~location_a)+
     stat_cor(aes(label = paste(..rr.label.., sep = "~`,`~")), method="spearman", na.rm=F,  p.accuracy = 0.001, show.legend = F)+ labs(x="NRCS Hand Method (%)", 
       y="5 Minute Method (mm)",
       title="Correlation between NRCS vs 5 minute MWD by Location", shape="Horizon", color="Treatment") +
   scale_y_continuous(limits=c(0,5)) +
  theme_classic()+
  geom_point(size=2, aes(shape=horizon_a))+
  theme_James2() +
    stat_regline_equation(label.x=30, show.legend = F) 

   ggsave("NRCS5mincor.png",  height=6, width=9)



#Has correlation by treatment by location and has eclipses

soils %>%
ggplot(aes(x=nagg, y= x5mwd, color=treatment))+
  facet_wrap(~location_a)+
     stat_cor(aes(label = paste(..r.label..,..rr.label.., ..p.label.., sep = "~`,`~")), method="spearman", na.rm=F,  p.accuracy = 0.001, show.legend = F)+ labs(x="NRCS Hand Method (%)", 
       y="5 Minute Method (mm)",
       title="Correlation between NRCS vs 5 minute MWD by Location", shape="Horizon", color="Treatment") +
   scale_y_continuous(limits=c(0,5)) +
  theme_classic()+
  geom_point(size=2, aes(shape=horizon_a))+
  theme_James2() +
geom_mark_ellipse(expand=0, aes(fill=treatment), show.legend = F)

12.5 MWD Bland-Altman plots

library(BlandAltmanLeh)

nrcs <-as.numeric(soils$nagg, na.rm=FALSE)
n20mwd <- as.numeric(soils$x20mwd, na.rm=FALSE)
n5mwd <- as.numeric(soils$x5mwd, na.rm=FALSE)

#Bland-Altman Plots for 20 minute Mean Weight Diameter vs NRCS Hand Method

soils %>%
ggplot(aes(x=((x20mwd+nagg)/2), y= (x20mwd-nagg)))+
  geom_point(size=.5)+
  labs(x="20 minute method", 
       y="NRCS hand method",
       title="Bland-Altman Plots for 20 minute Mean Weight Diameter vs NRCS Hand Method") +
  theme_classic()

bland.altman.plot(n20mwd, nrcs, xlab="Means", ylab="Differences", na.rm=FALSE)

## NULL
#Bland-Altman Plots for 20 minute Mean Weight Diameter vs 5 minute Method

soils %>%
ggplot(aes(x=((x20mwd+x5mwd)/2), y= (x5mwd-x20mwd)))+
  geom_point(size=.5)+
  labs(x="Means", 
       y="Differences",
       title="Bland-Altman Plots for 20 minute Mean Weight Diameter vs 5 minute Method") +
  theme_classic()

bland.altman.plot(n5mwd, n20mwd, xlab="Means", ylab="Differences")

## NULL
modmwd <- lm(x5mwd ~ x20mwd, data=soils)
summary(modmwd)
## 
## Call:
## lm(formula = x5mwd ~ x20mwd, data = soils)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.80182 -0.29896 -0.05003  0.25248  1.69542 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.47598    0.08690   5.477 1.97e-07 ***
## x20mwd       0.77398    0.07955   9.730  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5386 on 139 degrees of freedom
## Multiple R-squared:  0.4051, Adjusted R-squared:  0.4009 
## F-statistic: 94.67 on 1 and 139 DF,  p-value: < 2.2e-16

12.5.1 Correlation plots for group depths

#20 minute Mean Weight Diameter vs 5 minute Method
#group by location



soils %>%
ggplot(aes(x=x20mwd, y= x5mwd, color=treatment))+
  facet_wrap(~location_a)+
  labs(x="20 Minute Method (mm)", 
       y="5 Minute Method (mm)",
       title="Correlation between 20 vs 5 minute MWD by Location", shape="Horizon", color="Treatment") +
   scale_y_continuous(limits=c(0,5)) +
  theme_classic()+
 geom_point(size=2)+
  theme_James2()+ 
    stat_cor(aes(label = paste(..r.label..,..rr.label.., ..p.label.., sep = "~`,`~")), method="spearman", na.rm=F,  p.accuracy = 0.001, show.legend = F)

#Has correlation by treatment by location
soils %>%
ggplot(aes(x=x20mwd, y= x5mwd, color=treatment))+
  facet_wrap(~location_a)+
     stat_cor(aes(label = paste(..r.label..,..rr.label.., ..p.label.., sep = "~`,`~")), method="spearman", na.rm=F,  p.accuracy = 0.001, show.legend = F)+ labs(x="20 Minute Method (mm)", 
       y="5 Minute Method (mm)",
       title="Correlation between 20 vs 5 minute MWD by Location", shape="Horizon", color="Treatment") +
   scale_y_continuous(limits=c(0,5)) +
  theme_classic()+
  geom_point(size=2, aes(shape=horizon_a))+
  theme_James2()

#Has correlation by treatment by location and has eclipses

soils %>%
ggplot(aes(x=x20mwd, y= x5mwd, color=treatment))+
  facet_wrap(~location_a)+
     stat_cor(aes(label = paste(..r.label..,..rr.label.., ..p.label.., sep = "~`,`~")), method="spearman", na.rm=F,  p.accuracy = 0.001, show.legend = F)+ labs(x="20 Minute Method (mm)", 
       y="5 Minute Method (mm)",
       title="Correlation between 20 vs 5 minute MWD by Location", shape="Horizon", color="Treatment") +
   scale_y_continuous(limits=c(0,5)) +
  theme_classic()+
  geom_point(size=2, aes(shape=horizon_a))+
  theme_James2() +
geom_mark_ellipse(expand=0, aes(fill=treatment), show.legend = F)