rm(list=ls())# wipes slate clean library(dplyr) library(ggplot2) library(gapminder) library(colorspace) setwd("C:/Users/Ragenaky/Desktop/Thesis chapter 3/Data/Master Sheets") MST_RC_ASD_IMP_WD_BOXPLOT<-read.csv("MST_RC_ASD_IMP_WD_BOXPLOT.CSV") MST_RC_ASD_IMP_WD_BOXPLOT$logM=log(MST_RC_ASD_IMP_WD_BOXPLOT[,26]+1)##Simplest log transformation y <- MST_RC_ASD_IMP_WD_BOXPLOT$logM plot(x, y, main = "Intercrop Weed Response", xlab = "Log Control WD", ylab = "Log Treatment WD", pch = 19, frame = FALSE) abline(lm(y ~ x, data = MST_IC_ASD_IMP_WD_BOXPLOT), col = "blue") # Boxplot for Weed Species ggplot(MST_RC_ASD_IMP_WD_BOXPLOT, aes(x= reorder(W_SP,y , FUN = median), y, fill=C_T))+# This reorders accoding to FUN geom_boxplot()+ scale_fill_discrete(name = "Control / Treament", )+# This can change legend name ggtitle("Effects of Weed Spp on Weed Density") + xlab("Weed Species") + ylab("Mean Log Weed Density") # Boxplot for Rotation Crop ggplot(MST_RC_ASD_IMP_WD_BOXPLOT, aes(x= reorder(RC_1_SP,y , FUN = median), y, fill=C_T))+# This reorders accoding to FUN geom_boxplot()+ scale_fill_discrete(name = "Control / Treament", )+# This can change legend name ggtitle("Rotation Crop Effects on Parasitic Weed Density") + xlab("Rotation Crop") + ylab("Mean Log Weed Density")+ theme(axis.text.x = element_text(angle = 50, hjust=.91)) # Boxplot for Rotation Crop Family ggplot(MST_RC_ASD_IMP_WD_BOXPLOT, aes(x= reorder(R_F,y , FUN = median), y, fill=C_T))+# This reorders accoding to FUN geom_boxplot()+ scale_fill_discrete(name = "Control / Treament", )+# This can change legend name ggtitle("Rotation Crop Family Effects on Parasitic Weed Density") + xlab("Rotation Crop Family") + ylab("Mean Log Weed Density")+ theme(axis.text.x = element_text(angle = 50, hjust=.91)) ####YEILD BELOW MST_RC_ASD_IMP_YD_BOXPLOT<-read.csv("MST_RC_ASD_IMP_YD_BOXPLOT.CSV") y <- MST_RC_ASD_IMP_YD_BOXPLOT$Control_Mean # Boxplot for Weed Species ggplot(MST_RC_ASD_IMP_YD_BOXPLOT, aes(x= reorder(W_SP,y , FUN = median), y, fill=C_T))+# This reorders accoding to FUN geom_boxplot()+ scale_fill_discrete(name = "Control / Treament", )+# This can change legend name ggtitle("Effects of Weed Spp on Crop Yield") + xlab("Weed Species") + ylab("Mean Crop Yield (T/ha)") # Boxplot for Rotation Crop ggplot(MST_RC_ASD_IMP_YD_BOXPLOT, aes(x= reorder(RC_1_SP,y , FUN = median), y, fill=C_T))+# This reorders accoding to FUN geom_boxplot()+ scale_fill_discrete(name = "Control / Treament", )+# This can change legend name ggtitle("Rotation Crop Effects on Crop Yield") + xlab("Rotation Crop") + ylab("Mean Crop Yield (T/ha)")+ theme(axis.text.x = element_text(angle = 50, hjust=.91)) # Boxplot for Rotation Crop Family ggplot(MST_RC_ASD_IMP_YD_BOXPLOT, aes(x= reorder(R_F,y , FUN = median), y, fill=C_T))+# This reorders accoding to FUN geom_boxplot()+ scale_fill_discrete(name = "Control / Treament", )+# This can change legend name ggtitle("Rotation Crop Family Effects on Crop Yield") + xlab("Rotation Crop Family") + ylab("Mean Crop Yield (T/ha)")+ theme(axis.text.x = element_text(angle = 50, hjust=.91))