Also, analysis for the numbers reported in the paper (e.g., number of studies and entries/study)
Load Libraries
library(ezknitr)
library(knitr)
library(devtools)
library(ggplot2)
library(ggthemes)
library(gridExtra)
library(cowplot)
##
## Attaching package: 'cowplot'
## The following object is masked from 'package:ggplot2':
##
## ggsave
Clear environment and set seed
remove(list=ls())
set.seed(776)
Document settings
opts_chunk$set(fig.width = 6, fig.height = 4)
load(file="data/output_data/summary_results.R")
Separate by analysis
analysis.split <- split(summary.means, summary.means$Analysis)
category.split <- split(summary.means, summary.means$Category)
wide <- merge(category.split$Rust, category.split$Yield, by = "Moderator",all=T)
wide <- merge(wide, category.split$`Seed Weight`, by = "Moderator",all = T)
make 3-way comparison
new.wide.rust <- category.split$Rust
new.wide.y100 <- rbind(category.split$Yield, category.split$`Seed Weight`)
new.wide.yV100 <- merge(category.split$Yield, category.split$`Seed Weight`, all=T, by="Moderator")
new.wide.yV100$Comparison <- "Yield vs 100-sw"
new.wide <- merge(new.wide.rust, new.wide.y100, by = "Moderator",all = T)
new.wide$Comparison[new.wide$Category.y=="Seed Weight"] <- "Rust vs. 100-sw"
new.wide$Comparison[new.wide$Category.y=="Yield"] <- "Rust vs. Yield"
new.wide.3way <- rbind(new.wide, new.wide.yV100)
new.wide.3way <- subset(new.wide.3way, !is.na(Comparison))
new.wide.3way <- subset(new.wide.3way, !is.na(Analysis.x))
################################################################################
# First, will want to annotate 2013 result in facet 2
annotate2013 <- data.frame(Comparison = "Rust vs. Yield",
Mean.x = 0.44,
Mean.y = 1.1)
ggplot(data = new.wide.3way,
aes(x = Mean.x, y = Mean.y))+
geom_point(colour="grey")+
geom_errorbar(aes(ymin=LL.y, ymax=UL.y),colour="grey")+
geom_errorbarh(aes(xmin=LL.x, xmax=UL.x),colour="grey")+
geom_errorbar(data = new.wide.3way[new.wide.3way$Analysis.x=="Overall Mean",],
aes(ymin=LL.y,ymax=UL.y),colour="black",width=0)+
geom_errorbarh(data = new.wide.3way[new.wide.3way$Analysis.x=="Overall Mean",],
aes(xmin=LL.x,xmax=UL.x),colour="black",height=0)+
geom_point(data = new.wide.3way[new.wide.3way$Analysis.x=="Overall Mean",],
colour="black",size=2)+
theme_tufte()+
ylab("Response Ratio (95% C.I.)")+
xlab("Response Ratio (95% C.I.)")+
facet_wrap(~Comparison, scales = "free_x")+
geom_text(data = annotate2013, label = "2013", family="serif")
## Warning: Removed 7 rows containing missing values (geom_point).
## Warning: Removed 7 rows containing missing values (geom_errorbar).
## Warning: Removed 7 rows containing missing values (geom_errorbarh).
pd <- position_dodge(width=0.3)
Active Ingredient and Fungicide Class
annotateAI <- data.frame(Mean = 1.6, Moderator = "FLUT", Category="Rust")
p1 <- ggplot(data = summary.means[summary.means$Analysis=="Active Ingredient",],
aes(x = Moderator, y = Mean, colour=Category, shape=Category))+
geom_pointrange(aes(ymin = LL, ymax = UL), position=pd)+
geom_hline(aes(yintercept=1), colour="grey")+
scale_x_discrete(limits=c("FLUT","PYR","TEBU","MIXED","AZO_PROP"),
labels=c("FLUT","PYR","TEBU","Mixed","AZO + \nPROP"))+
xlab("Active Ingredient")+
ylab("")+
ylim(c(0,1.7))+
theme_tufte()+
theme(legend.position = "none")+
geom_text(data = annotateAI, label="B", family="serif")+
scale_color_manual(values = c("#000000","#FC575E","#44BBFF"))
annotateClass <- data.frame(Mean = 1.6, Moderator = "OVERALL", Category = "Rust")
p2 <- ggplot(data = summary.means[summary.means$Analysis=="Fungicide Class"|
summary.means$Moderator=="OVERALL",],
aes(x = Moderator, y = Mean, colour=Category, shape=Category))+
geom_pointrange(aes(ymin = LL, ymax = UL), position=pd)+
geom_hline(aes(yintercept=1), colour="grey")+
geom_vline(aes(xintercept=1.5), colour="grey")+
scale_x_discrete(limits=c("OVERALL","Strobilurin", "Triazole", "Triaz_Strob"),
labels=c("Overall","Strobilurin", "Triazole", "Mixed Triazole\n& Strobilurin"))+
ylab("Mean Effect Size (95% C.I.)")+
xlab("Fungicide Class")+
ylim(c(0,1.7))+
theme_tufte()+
theme(legend.position = "none")+
geom_text(data = annotateClass, label="A", family="serif")+
scale_color_manual(values = c("#000000","#FC575E","#44BBFF"))
grid.arrange(p2, p1, ncol=2)
## Warning: Removed 13 rows containing missing values (geom_pointrange).
## Warning: Removed 14 rows containing missing values (geom_pointrange).
Disease Pressure, Growth Stage, and Applications
annotatePress <- data.frame(Mean = 1.6, Moderator = "low", Category="Rust")
p3 <- ggplot(data = summary.means[summary.means$Analysis=="Disease Pressure",],
aes(x = Moderator, y = Mean, colour=Category, shape=Category))+
geom_pointrange(aes(ymin = LL, ymax = UL), position=pd)+
geom_hline(aes(yintercept=1), colour="grey")+
scale_x_discrete(limits=c("low","medium","high"),
labels=c("Low","Medium","High"))+
ylab("")+
xlab("Disease Pressure")+
theme_tufte()+
theme(legend.position = "none")+
geom_text(data = annotatePress, label="C", family="serif")+
scale_color_manual(values = c("#000000","#FC575E","#44BBFF"))
annotateRstage <- data.frame(Mean = 1.6, Moderator = "R1+", Category="Rust")
p4 <- ggplot(data = summary.means[summary.means$Analysis=="Growth Stage",],
aes(x = Moderator, y = Mean, colour=Category, shape=Category))+
geom_pointrange(aes(ymin = LL, ymax = UL), position=pd)+
geom_hline(aes(yintercept=1), colour="grey")+
scale_x_discrete(limits=c("R1+","R2+","R3","R5"),
labels=c("R1+","R2+","R3","R5"))+
ylab("")+
xlab("Growth Stage")+
theme_tufte()+
theme(legend.position = "none")+
geom_text(data = annotateRstage, label="B", family="serif")+
scale_color_manual(values = c("#000000","#FC575E","#44BBFF"))
annotateApps <- data.frame(Mean = 1.6, Moderator = "OVERALL", Category="Rust")
p5 <- ggplot(data = summary.means[summary.means$Analysis=="Applications"|
summary.means$Moderator=="OVERALL",],
aes(x = Moderator, y = Mean, colour=Category, shape=Category))+
geom_pointrange(aes(ymin = LL, ymax = UL), position=pd)+
geom_hline(aes(yintercept=1), colour="grey")+
geom_vline(aes(xintercept=1.5), colour="grey")+
scale_x_discrete(limits=c("OVERALL","1 Application","2 Applications"),
labels=c("Overall","1","2"))+
ylab("Mean Effect Size (95% C.I.)")+
xlab("Applications")+
theme_tufte()+
theme(legend.position = "none")+
geom_text(data = annotateApps, label="A", family="serif")+
scale_color_manual(values = c("#000000","#FC575E","#44BBFF"))
grid.arrange(p5, p4, p3, ncol=3)
## Warning: Removed 13 rows containing missing values (geom_pointrange).
## Warning: Removed 13 rows containing missing values (geom_pointrange).
## Warning: Removed 13 rows containing missing values (geom_pointrange).
Study Year
ggplot(data = summary.means[summary.means$Analysis=="Study Year"|
summary.means$Moderator=="OVERALL",],
aes(x = Moderator, y = Mean, colour=Category, shape=Category))+
geom_pointrange(aes(ymin = LL, ymax = UL), position=pd)+
geom_hline(aes(yintercept=1), colour="grey")+
geom_vline(aes(xintercept=1.5), colour="grey")+
scale_x_discrete(limits=c("OVERALL","2006","2007","2008","2009","2010","2011","2012","2013"),
labels=c("Overall","2006","2007","2008","2009","2010","2011","2012","2013"))+
ylab("Mean Effect Size (95% C.I.)")+
xlab("Study Year")+
theme_tufte()+
theme(legend.position = "none")+
scale_color_manual(values = c("#000000","#FC575E","#44BBFF"))
## Warning: Removed 13 rows containing missing values (geom_pointrange).
Spun with ezspin(“programs/results_plotting.R”, out_dir=“output”, fig_dir=“figures”, keep_md=FALSE)
Session Info:
devtools::session_info()
## Session info --------------------------------------------------------------
## setting value
## version R version 3.3.2 (2016-10-31)
## system x86_64, darwin13.4.0
## ui RStudio (0.99.902)
## language (EN)
## collate en_US.UTF-8
## tz America/Chicago
## date 2017-01-25
## Packages ------------------------------------------------------------------
## package * version date source
## assertthat 0.1 2013-12-06 CRAN (R 3.3.0)
## colorspace 1.3-2 2016-12-14 CRAN (R 3.3.2)
## cowplot * 0.7.0 2016-10-28 CRAN (R 3.3.0)
## devtools * 1.12.0 2016-06-24 CRAN (R 3.3.0)
## digest 0.6.10 2016-08-02 CRAN (R 3.3.0)
## doBy * 4.5-15 2016-03-31 CRAN (R 3.3.0)
## evaluate 0.10 2016-10-11 CRAN (R 3.3.0)
## ezknitr * 0.6 2016-09-16 CRAN (R 3.3.0)
## ggplot2 * 2.2.0 2016-11-11 cran (@2.2.0)
## ggthemes * 3.3.0 2016-11-24 CRAN (R 3.3.2)
## gridExtra * 2.2.1 2016-02-29 CRAN (R 3.3.0)
## gtable 0.2.0 2016-02-26 CRAN (R 3.3.0)
## highr 0.6 2016-05-09 CRAN (R 3.3.0)
## knitr * 1.15.1 2016-11-22 CRAN (R 3.3.2)
## labeling 0.3 2014-08-23 CRAN (R 3.3.0)
## lattice 0.20-34 2016-09-06 CRAN (R 3.3.2)
## lazyeval 0.2.0 2016-06-12 CRAN (R 3.3.0)
## magrittr 1.5 2014-11-22 CRAN (R 3.3.0)
## markdown 0.7.7 2015-04-22 CRAN (R 3.3.0)
## MASS 7.3-45 2016-04-21 CRAN (R 3.3.2)
## Matrix * 1.2-7.1 2016-09-01 CRAN (R 3.3.2)
## memoise 1.0.0 2016-01-29 CRAN (R 3.3.0)
## metafor * 1.9-9 2016-09-25 CRAN (R 3.3.0)
## munsell 0.4.3 2016-02-13 CRAN (R 3.3.0)
## plyr 1.8.4 2016-06-08 CRAN (R 3.3.0)
## R.methodsS3 1.7.1 2016-02-16 CRAN (R 3.3.0)
## R.oo 1.21.0 2016-11-01 CRAN (R 3.3.0)
## R.utils 2.5.0 2016-11-07 CRAN (R 3.3.0)
## Rcpp 0.12.8 2016-11-17 CRAN (R 3.3.2)
## rstudioapi 0.6 2016-06-27 CRAN (R 3.3.0)
## scales 0.4.1 2016-11-09 cran (@0.4.1)
## stringi 1.1.2 2016-10-01 CRAN (R 3.3.0)
## stringr 1.1.0 2016-08-19 CRAN (R 3.3.0)
## tibble 1.2 2016-08-26 CRAN (R 3.3.0)
## withr 1.0.2 2016-06-20 CRAN (R 3.3.0)