library(readxl)
## Warning: package 'readxl' was built under R version 4.4.2
bird_Ohio <- read_excel("C:/Users/Dell/Downloads/Telegram Desktop/bird_Ohio.xlsx")
env_Ohio <- read_excel("C:/Users/Dell/Downloads/Telegram Desktop/env_Ohio.xlsx")
library("vegan")
## Warning: package 'vegan' was built under R version 4.4.2
## Loading required package: permute
## Warning: package 'permute' was built under R version 4.4.2
## Loading required package: lattice
## This is vegan 2.6-8
data(bird_Ohio)
## Warning in data(bird_Ohio): data set 'bird_Ohio' not found
bird_Ohio
ncol(bird_Ohio)
## [1] 48
sp.rich<-specnumber(bird_Ohio, MARGIN=1)
as.data.frame(sp.rich)
sp.even<-specnumber(bird_Ohio, MARGIN=2)
as.data.frame(sp.even)
?diversity
## starting httpd help server ... done
shannon<-diversity(bird_Ohio, index = "shannon")
shannon
## [1] 1.812353 2.443171 2.502177 2.449965 2.505759 2.508055 2.808416 2.632368
## [9] 2.573988 2.450999 2.394499 2.670755 2.531704 2.538192 2.502138 2.671630
## [17] 2.157016 2.003041 2.458384 2.517153 2.887236 2.238884 2.518361 2.459535
## [25] 2.299249 2.324144 2.388357 2.443737 2.508801 2.239565 2.719239 2.669216
## [33] 2.564513 2.220202 2.371608 2.728757 2.523222 2.698767 1.974502 2.403435
## [41] 3.027143 2.929427 2.232029 2.326931 2.594871 2.428581 2.325057 1.853327
## [49] 2.769102 2.504465 2.236733 2.948820 2.471493 2.608128 3.043401 2.600579
## [57] 2.280595 2.117042 2.003623 2.829905 2.496714 2.873540 2.406037 2.131073
## [65] 2.430766 2.713367 2.503175 2.517794 2.595210 2.233722 2.332257 2.371660
## [73] 2.292052 2.391518 2.657784 2.475737 2.734494 2.356708 2.438921 2.292174
## [81] 2.230160 2.444628 1.498985 2.542779 2.550645 2.736674 2.453161 2.339160
## [89] 2.291078 2.258330 2.477123 2.602002 2.135238 2.001804 2.482235 2.668960
## [97] 2.858335 2.649933 2.453522 2.865006 2.783952 2.998991 2.771560 2.295914
## [105] 2.824489 2.383109 2.503965 2.634558 2.629183 2.519069 1.944464 2.445383
## [113] 2.350606 2.406909 2.321891 2.375944 2.767400 2.843069 2.707323 2.148480
## [121] 2.363373 2.489638 2.574951 2.517391 2.515402 2.707214 2.297690 2.547743
## [129] 2.178186 2.640613 2.353198 2.386311 2.588825 2.240908 2.631116 3.003723
## [137] 2.852913 2.490412 2.839435 2.716773 2.980252 2.197722 1.798709 2.885919
## [145] 3.032903 2.485085 2.314192 2.241601 1.916081 2.567405 3.158537 2.891359
## [153] 2.280094 2.767268 3.111523 2.444470 2.548230 2.518348 2.349092 2.625978
## [161] 2.451639 2.764880 2.267142 3.161186 2.631644 2.692776 2.861356 2.906638
## [169] 2.784373 2.308865 2.092852 2.622334 2.513477 2.282174 2.446827 2.388816
## [177] 2.275937 2.354834 2.518677 2.193424 2.352495 2.779190 2.201542 2.549830
## [185] 2.561493 2.912577 2.307692 2.637404 2.831398 2.850695 2.344426 2.665442
## [193] 2.467880 2.850518 2.260180 2.756500 2.578963 2.309209 2.595555 2.466597
## [201] 2.418257 2.351541 2.665416 1.990114 2.435551 2.375377 2.154783 2.893215
## [209] 2.821822 2.495723
simpson
## [1] 0.7805326 0.8960000 0.9075255 0.8855556 0.9026709 0.9011446 0.9240237
## [8] 0.9110302 0.9070295 0.8999270 0.8799049 0.9196694 0.8888889 0.8962500
## [15] 0.9007561 0.9142661 0.8620038 0.8197531 0.8960302 0.9045369 0.9357639
## [22] 0.8616864 0.8697979 0.8830796 0.8786848 0.8776042 0.8829630 0.8850442
## [29] 0.8976082 0.8719723 0.9245578 0.9113564 0.9050365 0.8360000 0.8854685
## [36] 0.9157440 0.8912000 0.9079717 0.8266667 0.8847737 0.9387269 0.9382716
## [43] 0.8691650 0.8791308 0.9076543 0.8950000 0.8775000 0.7809917 0.9238683
## [50] 0.8980229 0.8823143 0.9409722 0.8960459 0.9151874 0.9464575 0.9135355
## [57] 0.8824142 0.8347107 0.8395062 0.9347352 0.9092971 0.9273192 0.8870523
## [64] 0.8546384 0.8946281 0.9188345 0.8836806 0.8945578 0.9047852 0.8755556
## [71] 0.8977778 0.8900227 0.8383743 0.8843537 0.9178994 0.8921324 0.9271163
## [78] 0.8833792 0.8899955 0.8757396 0.8698061 0.8863772 0.7321429 0.9112500
## [85] 0.9088757 0.9159111 0.8846154 0.8792000 0.8742791 0.8650765 0.9047619
## [92] 0.9126276 0.8577610 0.8448118 0.9032922 0.9145881 0.9304734 0.9073433
## [99] 0.8827977 0.9330652 0.9225839 0.9427660 0.9207786 0.8814879 0.9275148
## [106] 0.8897929 0.8994646 0.9161111 0.9120708 0.9000000 0.7976000 0.8922902
## [113] 0.8741319 0.8870392 0.8729339 0.8923182 0.9202477 0.9193787 0.9149520
## [120] 0.8515625 0.8741497 0.8921324 0.9022485 0.9037901 0.8891293 0.9149338
## [127] 0.8655500 0.8978052 0.8395062 0.9145408 0.8800000 0.8966837 0.9054134
## [134] 0.8526786 0.9104132 0.9400889 0.9307670 0.8930664 0.9362500 0.9239452
## [141] 0.9383673 0.8441358 0.7929240 0.9388889 0.9432398 0.8966667 0.8854644
## [148] 0.8702422 0.8138013 0.9071220 0.9499541 0.9307195 0.8691716 0.9120499
## [155] 0.9468599 0.8955442 0.8949804 0.9037901 0.8696377 0.9083176 0.8940972
## [162] 0.9189189 0.8529779 0.9519312 0.9084298 0.9137329 0.9341564 0.9375000
## [169] 0.9126658 0.8780992 0.8480726 0.9066607 0.8948148 0.8680556 0.8999082
## [176] 0.8753463 0.8734995 0.8911565 0.8966667 0.8577610 0.8888889 0.9228395
## [183] 0.8440083 0.9104540 0.9053498 0.9396386 0.8804283 0.9167658 0.9286332
## [190] 0.9297778 0.8928200 0.9150327 0.8883929 0.9329660 0.8786848 0.9156283
## [197] 0.9032922 0.8792867 0.9061250 0.8888889 0.8756378 0.8664554 0.9191176
## [204] 0.8337950 0.8915289 0.8835063 0.8700000 0.9325017 0.9287965 0.8692904
inv.simpson
## [1] 4.556485 9.615385 10.813793 8.737864 10.274419 10.115789 13.161994
## [8] 11.239766 10.756098 9.992701 8.326733 12.448560 9.000000 9.638554
## [15] 10.076190 11.664000 7.246575 5.547945 9.618182 10.475248 15.567568
## [22] 7.229947 7.680365 8.552826 8.242991 8.170213 8.544304 8.698997
## [29] 9.766404 7.810811 13.255172 11.281124 10.530364 6.097561 8.731225
## [36] 11.868597 9.191176 10.866221 5.769231 8.678571 16.320388 16.200000
## [43] 7.643216 8.273408 10.828877 9.523810 8.163265 4.566038 13.135135
## [50] 9.806122 8.497207 16.941176 9.619632 11.790698 18.676768 11.565445
## [57] 8.504425 6.050000 6.230769 15.322188 11.025000 13.758794 8.853659
## [64] 6.879397 9.490196 12.320513 8.597015 9.483871 10.502564 8.035714
## [71] 9.782609 9.092784 6.187135 8.647059 12.180180 9.270627 13.720497
## [78] 8.574803 9.090535 8.047619 7.680851 8.801047 3.733333 11.267606
## [85] 10.974026 11.892178 8.666667 8.278146 7.954128 7.411609 10.500000
## [92] 11.445255 7.030418 6.443787 10.340426 11.707965 14.382979 10.792531
## [99] 8.532258 14.939914 12.917211 17.472131 12.622857 8.437956 13.795918
## [106] 9.073826 9.946746 11.920530 11.372781 10.000000 4.940711 9.284211
## [113] 7.944828 8.852632 7.869919 9.286624 12.538824 12.403670 11.758065
## [120] 6.736842 7.945946 9.270627 10.230024 10.393939 9.019512 11.755556
## [127] 7.437710 9.785235 6.230769 11.701493 8.333333 9.679012 10.572327
## [134] 6.787879 11.162362 16.691395 14.443983 9.351598 15.686275 13.148410
## [141] 16.225166 6.415842 4.829146 16.363636 17.617978 9.677419 8.730909
## [148] 7.706667 5.370607 10.766816 19.981651 14.434084 7.643599 11.370079
## [155] 18.818182 9.573427 9.522034 10.393939 7.670927 10.907216 9.442623
## [162] 12.333333 6.801700 20.803509 10.920578 11.591900 15.187500 16.000000
## [169] 11.450262 8.203390 6.582090 10.713604 9.507042 7.578947 9.990826
## [176] 8.022222 7.905109 9.187500 9.677419 7.030418 9.000000 12.960000
## [183] 6.410596 11.167442 10.565217 16.566879 8.363184 12.014286 14.012121
## [190] 14.240506 9.330097 11.769231 8.960000 14.917808 8.242991 11.852321
## [197] 10.340426 8.284091 10.652459 9.000000 8.041026 7.488136 12.363636
## [204] 6.016667 9.219048 8.584158 7.692308 14.815182 14.044248 7.650549
fish.alp<-fisher.alpha(bird_Ohio)
fish.alp
## [1] 4.879601 7.265437 5.991450 7.139089 7.612305 6.987499 11.700302
## [8] 8.514440 7.645338 8.203268 8.096417 9.316717 10.625244 11.170180
## [15] 8.704701 10.438229 5.277516 5.354320 7.741632 8.704701 14.235471
## [22] 5.563489 10.802080 8.827385 6.444680 6.644209 7.878918 7.161667
## [29] 7.814550 6.610003 8.514440 11.689884 8.929434 8.136595 6.745910
## [36] 9.869081 9.074933 12.010405 5.252615 6.879711 15.000086 13.840139
## [43] 5.922455 6.745910 9.946552 7.656867 6.691741 5.685388 11.492806
## [50] 6.987499 5.098572 15.718214 7.483241 10.136431 22.398229 8.549933
## [57] 7.182494 6.227126 4.586486 9.261872 7.353659 12.333742 9.181666
## [64] 5.292913 7.088144 9.348894 9.392030 10.625244 8.326654 6.264404
## [71] 6.264404 6.444680 8.704701 8.347135 8.791663 8.660992 10.665986
## [78] 7.912277 7.612305 6.828399 6.040326 9.650566 2.342557 8.717218
## [85] 6.781181 10.483605 7.896600 6.456369 6.369414 6.207709 7.353659
## [92] 8.306262 4.776899 4.076606 6.879711 9.238619 14.386674 9.915005
## [99] 9.749784 12.719495 9.512046 12.467435 14.572309 4.771091 13.095785
## [106] 6.286631 8.525511 7.904514 8.514440 8.136595 5.007071 8.347135
## [113] 7.490234 6.559906 7.088144 6.132369 10.691663 15.780397 11.492806
## [120] 6.973786 8.347135 8.660992 9.031307 8.266633 11.641119 13.465722
## [127] 6.745910 8.536862 6.127733 9.185480 6.456369 5.316444 10.886950
## [134] 6.712734 10.277584 14.105449 12.719495 7.565648 14.166726 8.614305
## [141] 13.911898 8.416321 4.257215 10.505202 17.331388 7.139089 5.780910
## [148] 6.610003 4.928004 9.228867 18.363340 12.375997 6.745910 11.212185
## [155] 16.327612 8.203268 8.660992 7.374796 8.266633 10.885075 7.490234
## [162] 17.764531 7.374796 15.828827 10.277584 10.366882 12.624488 11.851265
## [169] 11.519965 7.088144 4.850244 8.071292 9.946552 6.644209 9.181666
## [176] 8.198934 5.925432 6.444680 7.904514 5.521350 6.444680 18.528711
## [183] 6.227126 8.266633 8.536862 13.353647 6.564138 8.096417 11.284101
## [190] 11.323066 7.182494 10.976162 8.306262 21.505636 5.612435 14.105050
## [197] 9.454690 6.132369 9.060475 8.198934 8.306262 7.612305 7.992375
## [204] 3.725191 8.024966 7.161667 7.959047 12.375997 11.156386 9.710044
Div.Ind<-cbind.data.frame(shannon, simpson, inv.simpson, fish.alp)
Div.Ind
summary(Div.Ind)
## shannon simpson inv.simpson fish.alp
## Min. :1.499 Min. :0.7321 Min. : 3.733 Min. : 2.343
## 1st Qu.:2.334 1st Qu.:0.8788 1st Qu.: 8.251 1st Qu.: 6.746
## Median :2.499 Median :0.8961 Median : 9.629 Median : 8.267
## Mean :2.502 Mean :0.8936 Mean :10.239 Mean : 8.912
## 3rd Qu.:2.669 3rd Qu.:0.9148 3rd Qu.:11.744 3rd Qu.:10.420
## Max. :3.161 Max. :0.9519 Max. :20.804 Max. :22.398
data("env_Ohio")
## Warning in data("env_Ohio"): data set 'env_Ohio' not found
env_Ohio
Ohio_Env.Div<-cbind.data.frame(bird_Ohio, env_Ohio)
Ohio_Env.Div
summary(Ohio_Env.Div$all_stem_den)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 706 8100 12478 13370 17238 40402
Ohio_Env.Diver<-cbind.data.frame(env_Ohio,Div.Ind)
Ohio_Env.Diver
summary(Ohio_Env.Diver$Habitat)
## Length Class Mode
## 210 character character
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.4.2
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(rstatix)
## Warning: package 'rstatix' was built under R version 4.4.2
##
## Attaching package: 'rstatix'
## The following object is masked from 'package:stats':
##
## filter
Ohio_Env.Diver %>%
group_by(Habitat) %>%
get_summary_stats(simpson, type = "mean_sd")
Ohio_Env.Diver %>%
group_by(Habitat) %>%
get_summary_stats(simpson,type = "mean_sd")
Ohio_Env.Diver %>%
group_by(Habitat) %>%
get_summary_stats(shannon,type = "mean_sd")
Ohio_Env.Diver %>%
group_by(Habitat) %>%
get_summary_stats(inv.simpson,type = "mean_sd")
Ohio_Env.Diver %>%
group_by(Habitat) %>%
get_summary_stats(fish.alp,type = "mean_sd")
library("ggplot2")
## Warning: package 'ggplot2' was built under R version 4.4.2
Simp.habitat<-ggplot(Ohio_Env.Diver, aes(x = Habitat, y = simpson, fill = Habitat)) +
geom_boxplot() +
stat_summary(fun = mean, geom = "point", shape =21, size = 3, colour = "blue", fill="yellow")
InvSimp.habitat<-ggplot(Ohio_Env.Diver, aes(x = Habitat, y = inv.simpson, fill = Habitat)) +
geom_boxplot() +
stat_summary(fun = mean, geom = "point", shape =21, size = 3, colour = "blue", fill="yellow")
Fish.habitat<-ggplot(Ohio_Env.Diver, aes(x = Habitat, y = fish.alp, fill = Habitat)) +
geom_boxplot() +
stat_summary(fun = mean, geom = "point", shape =21, size = 3, colour = "blue", fill="yellow")
shanon.habitat<-ggplot(Ohio_Env.Diver, aes(x = Habitat, y = shannon, fill = Habitat)) +
geom_boxplot() +
stat_summary(fun = mean, geom = "point", shape =21, size = 3, colour = "blue", fill="yellow")
library("gridExtra")
## Warning: package 'gridExtra' was built under R version 4.4.2
##
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
##
## combine
grid.arrange(shanon.habitat, Simp.habitat, InvSimp.habitat, Fish.habitat, nrow=2, ncol=2)

grid.arrange(shanon.habitat, Simp.habitat, InvSimp.habitat, Fish.habitat, nrow=2, ncol=2)

shannon_aov <- aov(Ohio_Env.Diver$shannon~Ohio_Env.Diver$Habitat)
summary(shannon_aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## Ohio_Env.Diver$Habitat 2 0.399 0.19958 2.817 0.0621 .
## Residuals 207 14.668 0.07086
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
simpson_aov <- aov(Ohio_Env.Diver$simpson~Ohio_Env.Diver$Habitat)
summary(simpson_aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## Ohio_Env.Diver$Habitat 2 0.00583 0.002916 2.776 0.0646 .
## Residuals 207 0.21744 0.001050
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
inv.simpson_aov <- aov(Ohio_Env.Diver$inv.simp~Ohio_Env.Diver$Habitat)
summary(inv.simpson_aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## Ohio_Env.Diver$Habitat 2 44.5 22.262 2.438 0.0899 .
## Residuals 207 1890.5 9.133
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
fish.alp_aov <- aov(Ohio_Env.Diver$fish.alp~Ohio_Env.Diver$Habitat)
summary(fish.alp_aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## Ohio_Env.Diver$Habitat 2 11.3 5.639 0.562 0.571
## Residuals 207 2077.8 10.037
shannon_Tukey<-TukeyHSD(shannon_aov, conf.level=.95, ordered = TRUE)
shannon_Tukey
## Tukey multiple comparisons of means
## 95% family-wise confidence level
## factor levels have been ordered
##
## Fit: aov(formula = Ohio_Env.Diver$shannon ~ Ohio_Env.Diver$Habitat)
##
## $`Ohio_Env.Diver$Habitat`
## diff lwr upr p adj
## Dry Mesic-Dry Oak 0.04362627 -0.0603278576 0.1475804 0.5835556
## Wet Mesic-Dry Oak 0.10671316 0.0004435631 0.2129827 0.0487920
## Wet Mesic-Dry Mesic 0.06308689 -0.0546961030 0.1808699 0.4169311
simpson_Tukey<-TukeyHSD(simpson_aov, conf.level=.95, ordered = TRUE)
simpson_Tukey
## Tukey multiple comparisons of means
## 95% family-wise confidence level
## factor levels have been ordered
##
## Fit: aov(formula = Ohio_Env.Diver$simpson ~ Ohio_Env.Diver$Habitat)
##
## $`Ohio_Env.Diver$Habitat`
## diff lwr upr p adj
## Dry Mesic-Dry Oak 0.003429337 -9.227491e-03 0.01608616 0.7984209
## Wet Mesic-Dry Oak 0.012841548 -9.719656e-05 0.02578029 0.0522377
## Wet Mesic-Dry Mesic 0.009412211 -4.928335e-03 0.02375276 0.2701554
inv.simpson_Tukey<-TukeyHSD(inv.simpson_aov, conf.level=.95, ordered = TRUE)
inv.simpson_Tukey
## Tukey multiple comparisons of means
## 95% family-wise confidence level
## factor levels have been ordered
##
## Fit: aov(formula = Ohio_Env.Diver$inv.simp ~ Ohio_Env.Diver$Habitat)
##
## $`Ohio_Env.Diver$Habitat`
## diff lwr upr p adj
## Dry Mesic-Dry Oak 0.3772352 -0.80294964 1.557420 0.7312016
## Wet Mesic-Dry Oak 1.1278123 -0.07865997 2.334284 0.0723818
## Wet Mesic-Dry Mesic 0.7505770 -0.58660612 2.087760 0.3828643
fish.alp_Tukey<-TukeyHSD(fish.alp_aov, conf.level=.95, ordered = TRUE)
fish.alp_Tukey
## Tukey multiple comparisons of means
## 95% family-wise confidence level
## factor levels have been ordered
##
## Fit: aov(formula = Ohio_Env.Diver$fish.alp ~ Ohio_Env.Diver$Habitat)
##
## $`Ohio_Env.Diver$Habitat`
## diff lwr upr p adj
## Dry Mesic-Dry Oak 0.07742881 -1.1598183 1.314676 0.9880401
## Wet Mesic-Dry Oak 0.55140864 -0.7133968 1.816214 0.5593155
## Wet Mesic-Dry Mesic 0.47397984 -0.9278564 1.875816 0.7045578
shannon_Tukey_plot <- as.data.frame(shannon_Tukey$`Ohio_Env.Diver$Habitat`)
shannon_Tukey_plot$comparison <- rownames(shannon_Tukey_plot)
shannon_Tukey_plot
simpson_Tukey_plot <- as.data.frame(simpson_Tukey$`Ohio_Env.Diver$Habitat`)
simpson_Tukey_plot$comparison <- rownames(simpson_Tukey_plot)
simpson_Tukey_plot
inv.simpson_Tukey_plot <- as.data.frame(inv.simpson_Tukey$`Ohio_Env.Diver$Habitat`)
inv.simpson_Tukey_plot$comparison <- rownames(inv.simpson_Tukey_plot)
inv.simpson_Tukey_plot
fish.alp_Tukey_plot <- as.data.frame(fish.alp_Tukey$`Ohio_Env.Diver$Habitat`)
fish.alp_Tukey_plot$comparison <- rownames(fish.alp_Tukey_plot)
fish.alp_Tukey_plot
shannon_Tukey_plot_result<-ggplot(shannon_Tukey_plot, aes(x = comparison, y = diff)) +
geom_point() +
geom_errorbar(aes(ymin = lwr, ymax = upr), width = 0.2) +
labs(
title = "Tukey HSD Test Results for Shannon Diversity",
x = "Habitat Comparison",
y = "Pairwise Difference in Mean"
)
shannon_Tukey_plot_result

shannon_Tukey_plot_result_meandiff<-shannon_Tukey_plot_result +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
geom_hline(yintercept=0, linetype="dashed", color = "red")
shannon_Tukey_plot_result_meandiff

simpson_Tukey_plot_result<-ggplot(simpson_Tukey_plot, aes(x = comparison, y = diff)) +
geom_point() +
geom_errorbar(aes(ymin = lwr, ymax = upr), width = 0.2) +
labs(
title = "Tukey HSD Test Results for Simpson Diversity",
x = "Habitat Comparison",
y = "Pairwise Difference in Mean"
)
simpson_Tukey_plot_result

simpson_Tukey_plot_result_meandiff<-simpson_Tukey_plot_result +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
geom_hline(yintercept=0, linetype="dashed", color = "red")
simpson_Tukey_plot_result_meandiff

inv.simpson_Tukey_plot_result<-ggplot(inv.simpson_Tukey_plot, aes(x = comparison, y = diff)) +
geom_point() +
geom_errorbar(aes(ymin = lwr, ymax = upr), width = 0.2) +
labs(
title = "Tukey HSD Test Results for inv.Simpson Diversity",
x = "Habitat Comparison",
y = "Pairwise Difference in Mean"
)
inv.simpson_Tukey_plot_result

inv.simpson_Tukey_plot_result_meandiff<-inv.simpson_Tukey_plot_result +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
geom_hline(yintercept=0, linetype="dashed", color = "red")
inv.simpson_Tukey_plot_result_meandiff

fish.alp_Tukey_plot_result<-ggplot(fish.alp_Tukey_plot, aes(x = comparison, y = diff)) +
geom_point() +
geom_errorbar(aes(ymin = lwr, ymax = upr), width = 0.2) +
labs(
title = "Tukey HSD Test Results for fish alpha Diversity",
x = "Habitat Comparison",
y = "Pairwise Difference in Mean"
)
fish.alp_Tukey_plot_result

fish.alp_Tukey_plot_result_meandiff<-fish.alp_Tukey_plot_result +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
geom_hline(yintercept=0, linetype="dashed", color = "red")
fish.alp_Tukey_plot_result_meandiff

grid.arrange(shannon_Tukey_plot_result_meandiff,shanon.habitat,nrow=1, ncol=2)

grid.arrange(simpson_Tukey_plot_result_meandiff,Simp.habitat,nrow=1, ncol=2)

grid.arrange(inv.simpson_Tukey_plot_result_meandiff,InvSimp.habitat,nrow=1, ncol=2)

grid.arrange(fish.alp_Tukey_plot_result_meandiff,Fish.habitat,nrow=1, ncol=2)
