Data entry and processing

Preamble

Load Libraries

library(ezknitr)
library(knitr)
library(metafor)
library(doBy)
library(devtools)

Clear environment

remove(list=ls())

Load data

raw.data <- read.csv("data/workspace.csv")

# FID #279 is repeated twice, replace one with 999
raw.data$FID[raw.data$FID==279&raw.data$trade.name=="Folicur"] <- 999

Processing data Steps

  1. Filter dataset with only selected fields
  2. Standardize categorical moderators
  3. Partition data
  4. Standardize effect size information
  5. Make sure categorical moderators are from at least 5 studies with at least 15 entries
  6. Calculate effect sizes
  7. Save files for analysis

1. New dataset with only selected fields

Remove fields that we don't use in analysis or processing

data.reduced <- raw.data[,c(1:7,10:17,19:48)]
# take out three data points with information on control treatments only
data.reduced <- data.reduced[data.reduced$FID!=105 &
                               data.reduced$FID!=154 &
                               data.reduced$FID!=211,]

Table of all data

summaryBy(FID~Reference+ReferenceNumb+studyYear+State, data = data.reduced, FUN = length)
##                 Reference ReferenceNumb studyYear State FID.length
## 1            Allen ref 11            11      2010    MS          7
## 2            Allen ref 12            12      2010    MS          8
## 3            Allen ref 13            13      2011    MS          5
## 4            Allen ref 14            14      2011    MS          5
## 5         Delanely ref 28            28      2013    AL          2
## 6     Delaney et al ref 6             6      2010    AL          8
## 7     Delaney et al ref 8             8      2011    AL         12
## 8          Delaney ref 17            17      2010    AL          8
## 9          Delaney ref 24            24      2010    AL          8
## 10         Delaney ref 26            26      2013    AL          3
## 11         Delaney ref 27            27      2013    AL          2
## 12         Delaney ref 29            29      2013    AL          2
## 13         Delaney ref 30            30      2013    AL          9
## 14         Delaney ref 31            31      2013    AL          9
## 15         Delaney ref 32            32      2013    AL          4
## 16         Delaney ref 33            33      2013    AL          4
## 17         Delaney ref 34            34      2013    AL         12
## 18         Delaney ref 44            44      2009    AL         13
## 19   Douglas et al ref 65            65      2008    FL         18
## 20   Douglas et al ref 66            66      2008    FL         13
## 21   Douglas et al ref 67            67      2009    FL         11
## 22          Harmon ref 47            47      2006    FL         12
## 23  Kemerait et al ref 59            59      2006    GA         15
## 24  Kemerait et al ref 71            71      2005    GA          8
## 25        Kemerait ref 46            46      2006    GA          5
## 26        Kemerait ref 49            49      2006    GA         12
## 27        Kemerait ref 50            50      2006    GA         10
## 28        Kemerait ref 51            51      2006    GA          7
## 29   Lawrence et al ref 3             3      2007    AL          7
## 30   lawrence et al ref 4             4      2005    AL          6
## 31  Lawrence et al ref 53            53      2007    AL          6
## 32  Lawrence et al ref 55            55      2006    AL         10
## 33  Lawrence et al ref 62            62      2007    AL          7
## 34  Lawrence et al ref 68            68      2013    AL          5
## 35        Lawrence ref 16            16      2008    AL         13
## 36        Lawrence ref 18            18      2006    AL          3
## 37        Lawrence ref 21            21      2005    AL          6
## 38        Lawrence ref 22            22      2008    AL          9
## 39        Lawrence ref 41            41      2006   AL          11
## 40   Mueller et al  ref 1             1      2007    FL          3
## 41   Mueller et al ref 63            63      2006    FL          6
## 42    Mueller et al ref 9             9      2007    FL          9
## 43         Mueller ref 36            36      2006    FL         23
## 44         Mueller ref 37            37      2006    FL         15
## 45         Mueller ref 38            38      2006    FL          6
## 46         Mueller ref 39            39      2006    FL         11
## 47         Mueller ref 40            40      2006    FL          4
## 48         Mueller ref 43            43      2006    GA         15
## 49         Mueller ref 45            45      2006    FL         17
## 50   O'Brien et al ref 69            69      2013    FL         13
## 51         O'Brien ref 25            25      2012    FL          7
## 52   Padgett et al ref 54            54      2007    LA          9
## 53   Padgett et al ref 72            72      2005    LA         15
## 54   Padgett et al ref 73            73      2005    LA         15
## 55     Price et al ref 35            35      2012    LA         12
## 56 Schneider et al ref 60            60      2006    LA         23
## 57     Sikora et al ref 7             7      2011    AL          4
## 58    Sikora et al ref 70            70      2005    AL         13
## 59    Sikora et al ref 74            74      2006    AL         12
## 60          Sikora ref 23            23      2007    AL         12
## 61          Sikora ref 42            42      2005    AL          7

2. Standardize categorical moderators

Active ingredients

Define mixed and 2+ applications of mixed (if 2+ applications of same, just use that active ingredient as is.)

# Active ingredients - fix typos in original dataset
data.reduced$active.ingredient.coded <- as.character(data.reduced$active.ingredient.coded)
data.reduced$active.ingredient.coded[data.reduced$trade.name=="ACT Plus"] <- "other"
data.reduced$active.ingredient.coded[data.reduced$trade.name=="Domark"] <- "TETR"
data.reduced$active.ingredient.coded[data.reduced$trade.name=="Folicur"] <- "TEBU"
data.reduced$active.ingredient.coded[data.reduced$trade.name=="Folicur fb Headline"] <- "tebu fb pyra"
data.reduced$active.ingredient.coded[data.reduced$trade.name=="Folicur + Headline"] <- "tebu + pyra"
data.reduced$active.ingredient.coded[data.reduced$trade.name=="Laredo"] <- "MYC"
data.reduced$active.ingredient.coded[data.reduced$trade.name=="Punch fb Punch"] <- "FLUS"
data.reduced$active.ingredient.coded[data.reduced$trade.name=="Stratego"] <- "prop + trif"

Active ingredients:

New code for analysis (e.g. >15 obs)

#     Start by making new field and storing the old code
data.reduced$activeIngClean <- "empty"
#     Mixed
mixed.indices <- grep("+", data.reduced$active.ingredient.coded, fixed=TRUE)
data.reduced$activeIngClean[mixed.indices] <- "mixed"
#     Dual applications
dual.apps <- grep("fb", data.reduced$active.ingredient.coded, fixed=TRUE)
data.reduced$activeIngClean[dual.apps] <- "dual"
data.reduced$activeIngClean[grep("azo fb azo", data.reduced$active.ingredient.coded, fixed=F)] <- "AZO"
data.reduced$activeIngClean[grep("myc fb myc", data.reduced$active.ingredient.coded, fixed=T)] <- "MYC"
data.reduced$activeIngClean[grep("tetr fb tetr", data.reduced$active.ingredient.coded, fixed=T)] <- "TETR"
data.reduced$activeIngClean[grep("tetra fb tetra", data.reduced$active.ingredient.coded, fixed=T)] <- "TETR"
data.reduced$activeIngClean[grep("tebu fb tebu", data.reduced$active.ingredient.coded, fixed=T)] <- "TEBU"
data.reduced$activeIngClean[grep("prop fb prop", data.reduced$active.ingredient.coded, fixed=T)] <- "PROP"
data.reduced$activeIngClean[grep("pyra fb pyra", data.reduced$active.ingredient.coded, fixed=T)] <- "PYR"
data.reduced$activeIngClean[grep("pyra fb prya", data.reduced$active.ingredient.coded, fixed=T)] <- "PYR"
data.reduced$activeIngClean[grep("flut fb flut", data.reduced$active.ingredient.coded, fixed=T)] <- "FLUT"

Rewrite combinations so that they are alphabetical

data.reduced$combo_complete <- NA
data.reduced$combo_complete[data.reduced$activeIngClean!="mixed"&
                              data.reduced$activeIngClean!="dual"] <- "single"

head(data.reduced[is.na(data.reduced$combo_complete),c(10:12,45:46)])
##            trade.name                active.ingredient
## 5   Tebuzol + Topsin        tebuconazole + thiophanate
## 9  Tebuzol  + Topsin        tebuconazole + thiophanate
## 13           Charisma         fluzilazole + famoxidone
## 14           Charisma         fluzilazole + famoxidone
## 21           Stratego propriconizole + trifloxystrobin
## 22           Stratego propriconizole + trifloxystrobin
##    active.ingredient.coded seedWtContLSD activeIngClean
## 5                 tebu+thi            NA          mixed
## 9                 tebu+thi            NA          mixed
## 13               fluz+famo            NA          mixed
## 14               fluz+famo            NA          mixed
## 21             prop + trif           0.5          mixed
## 22             prop + trif           0.5          mixed
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tebu+thi"] <- 
  "TEBU + THIO"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="fluz+famo"] <- 
  "FAMO + FLUZ"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tebu+sur"] <-
  "SURF + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tebu+trif+oth"] <-
  "TEBU + TRIF + OTH"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tebu+trif"] <-
  "TEBU + TRIF"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop+azo"] <- 
  "AZO + PROP"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="flux+pyra"] <- 
  "FLUX + PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop+azo"|
                           data.reduced$active.ingredient.coded=="pro+azo"] <-
  "AZO + PROP"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="flus+pic"] <- 
  "FLUS + PICO"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop+trif+prot"] <-
  "PROP + PROT + TRIF"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="azo+cypr"] <-
  "AZO + CYPR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="pyra+tebu"] <-
  "PYR + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop+trif"] <- 
  "PROP + TRIF"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop+trif+tebu"] <-
  "PROP + TEBU + TRIF"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="oth+flus"] <-
  "FLUS + OTH"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="flus+pyra"] <-
  "FLUS + PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="pyra+myc"] <- 
  "MYC + PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="pyra+flut"] <- 
  "FLUT + PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop+trif+myc"] <-
  "MYC + PROP + TRIF"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop+azo+tebu"] <- 
  "AZO + PROP + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop+azo+myc"] <- 
  "AZO + MYC + PROP"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop+azo+flut"] <- 
  "AZO + FLUT + PROP"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop+trif+flut"] <- 
  "FLUT + PROP + TRIF"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="oth+flut"] <- 
  "FLUT + OTH"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="azo+prop"] <- 
  "AZO + PROP"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="azo+dife"] <-
  "AZO + DIF"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prot+trif"] <- 
  "PROT + TRIF"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="flux+flut"] <- 
  "FLUT + FLUX"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="flut+azo"] <- 
  "AZO + FLUT"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tebu + pyra"] <- 
  "PYR + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="azo+flut"] <- 
  "AZO + FLUT"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="chl+tebu"] <- 
  "CHL + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="azo+tebu"] <- 
  "AZO + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="azo+myc"] <- 
  "AZO + MYC"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="azo+pyra"] <- 
  "AZO + PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="myc+pyra"] <- 
  "MYC + PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="fenb+pyra"] <-
  "FEN + PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tebu+sul"] <-
   "SUL + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="teb+cop"] <-
  "COPPER + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="teb+eth"] <- 
  "ETH + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="teb+thio"] <- 
  "TEBU + THIO"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tetr+azo"] <- 
  "AZO + TETR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tetr+ort"] <- 
  "ORTH + TETR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tetr+cro"] <- 
  "CROP + TETR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="cop+oth"] <- 
  "COPPER + OTH"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="eth+oth"] <- 
  "ETH + OTH"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="sul+oth"] <- 
  "SUL + OTH"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="thio+oth"] <- 
  "OTH + THIO"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="org+azo"] <- 
  "AZO + ORG" 
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="pyra fb tebu"] <- 
  "PYR fb TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="flut+eth"] <- 
  "ETH + FLUT"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="sul+ unknown"] <- 
  "SUL + OTH"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop+azo fb teb"] <-
  "AZO + PROP fb TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="pyra + other fb tebu"] <- 
  "OTH + PYR fb TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop+trif fb tebu"] <- 
  "PROP + TRIF fb TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="flut+pyra"] <- 
  "FLUT + PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop+azo fb tebu"] <- 
  "AZO + PROP fb TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="azo fb tebu"] <- 
  "AZO fb TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="azo fb myc"] <- 
  "AZO fb MYC"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="azo fb pyro"] <- 
  "AZO fb PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="azo fb pyro + tebu"] <- 
  "AZO fb PYR + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="azo fb flut"] <- 
  "AZO fb FLUT"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="chl fb tebu+chl"] <- 
  "CHL fb CHL + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="chl fb tebu"|
                           data.reduced$active.ingredient.coded=="chl fb tebu "] <- 
  "CHL fb TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="pyra+met"] <- 
  "MET + PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="pyra+teb"] <- 
  "PYR + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="myc + pyra"] <- 
  "MYC + PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="fenb+other"] <- 
  "FEN + OTH"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="unknown + flus"] <- 
  "FLUS + OTH"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="pyra + flus"] <- 
  "FLUS + PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="cypr + azo"] <- 
  "AZO + CYPR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="pyra + met"] <- 
  "MET + PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="flus + fam"] <-
  "FAMO + FLUS"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="flus + pyra"] <- 
  "FLUS + PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="flus + azo"] <- 
  "AZO + FLUS"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="pyra + tebu fb pyra"] <-
  "PYR + TEBU fb PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="pyra fb met"] <- 
  "PYR fb MET"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="flus + carb"] <- 
  "CARB + FLUS" 
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="cyp + azo"] <- 
  "AZO + CYPR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="thio + other"] <- 
  "OTH + THIO"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="chlo fb tebu"] <- 
  "CHL fb TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop + azo fb prop + azo"] <- 
  "AZO + PROP"
data.reduced$activeIngClean[data.reduced$active.ingredient.coded=="tria fb tria"] <- 
  "cypr"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tria fb tria"] <- "single"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop + azo"] <- 
  "AZO + PROP"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tebu + thio"] <- 
  "TEBU + THIO"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tebu + pyra + pyra"] <- 
  "PYR + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tebu + adj"] <- 
  "ADJ + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop + trif"] <- 
  "PROP + TRIF"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="pyra + adj"] <- 
  "ADJ + PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="flus + carb + picoxy"] <- 
  "CARB + FLUS + PICO"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="unknown + myc"] <- 
  "MYC + OTH"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="cyp + azo fb cyp"] <- 
  "AZO + CYPR fb CYPR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="flut + pyra"] <- 
  "FLUT + PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="flut + thio"] <- 
  "FLUT + THIO"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="thio fb tebu"] <- 
  "THIO fb TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="thio + tebu"] <- 
  "TEBU + THIO"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="pico + cypr"] <- 
  "CYPR + PICO"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prot + trif"] <- 
  "PROT + TRIF"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tebu + pyra fb tebu + pyra"] <- 
  "PYR + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tebu + pyra fb myc"] <- 
  "PYR + TEBU fb MYC"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop +trif fb tebu"] <- 
  "PROP + TRIF fb TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop + trif fb prya"] <- 
  "PROP + TRIF fb PYR"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop +azo fb tebu"] <- 
  "AZO + PROP fb TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop + azo fb myc"] <-
  "AZO + PROP fb MYC"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop + azy"] <- 
  "AZO + PROP"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tebu + chlor"] <- 
  "CHL + TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tebu + pyra fb tebu"] <- 
  "PYR + TEBU fb TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tebu +pyra fb flut"] <- 
  "PYR + TEBU fb FLUT"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop + trif fb tebu"] <- 
  "PROP + TRIF fb TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop + trif fb myc"] <- 
  "PROP + TRIF fb MYC"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop fb tebu"] <- 
  "PROP fb TEBU"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop fb myc"] <- 
  "PROP fb MYC"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop fb flut"] <- 
  "PROP fb FLUT"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="prop + trif fb flut"] <- 
  "PROP + TRIF fb FLUT"
data.reduced$alphaIngred[data.reduced$active.ingredient.coded=="tebu fb pyra"] <- 
  "TEBU fb PYR"
data.reduced$combo_complete[!is.na(data.reduced$alphaIngred)] <- "complete"

Look at results, do any have n >= 15?

sort(table(data.reduced$alphaIngred))
## 
##  AZO + CYPR fb CYPR          AZO + FLUS   AZO + FLUT + PROP 
##                   1                   1                   1 
##           AZO + MYC    AZO + MYC + PROP   AZO + PROP fb MYC 
##                   1                   1                   1 
##           AZO + PYR          AZO + TEBU          AZO + TETR 
##                   1                   1                   1 
##         AZO fb FLUT          AZO fb MYC          AZO fb PYR 
##                   1                   1                   1 
##   AZO fb PYR + TEBU         AZO fb TEBU         CARB + FLUS 
##                   1                   1                   1 
##  CARB + FLUS + PICO   CHL fb CHL + TEBU        COPPER + OTH 
##                   1                   1                   1 
##       COPPER + TEBU         CROP + TETR          ETH + FLUT 
##                   1                   1                   1 
##           ETH + OTH          ETH + TEBU         FAMO + FLUS 
##                   1                   1                   1 
##           FEN + OTH         FLUS + PICO          FLUT + OTH 
##                   1                   1                   1 
##  FLUT + PROP + TRIF         FLUT + THIO           MYC + OTH 
##                   1                   1                   1 
##   MYC + PROP + TRIF         ORTH + TETR   OTH + PYR fb TEBU 
##                   1                   1                   1 
##  PROP + PROT + TRIF PROP + TRIF fb FLUT  PROP + TRIF fb MYC 
##                   1                   1                   1 
##  PROP + TRIF fb PYR        PROP fb FLUT         PROP fb MYC 
##                   1                   1                   1 
##        PROP fb TEBU  PYR + TEBU fb FLUT  PYR + TEBU fb TEBU 
##                   1                   1                   1 
##              single          SUL + TEBU   TEBU + TRIF + OTH 
##                   1                   1                   1 
##   AZO + PROP + TEBU  AZO + PROP fb TEBU          CHL + TEBU 
##                   2                   2                   2 
##         FAMO + FLUZ           FEN + PYR          FLUS + OTH 
##                   2                   2                   2 
##          OTH + THIO   PYR + TEBU fb MYC          PYR fb MET 
##                   2                   2                   2 
##           SUL + OTH         SURF + TEBU        THIO fb TEBU 
##                   2                   2                   2 
##           ADJ + PYR          ADJ + TEBU           AZO + DIF 
##                   3                   3                   3 
##           AZO + ORG         CHL fb TEBU         CYPR + PICO 
##                   3                   3                   3 
##           MET + PYR PROP + TRIF fb TEBU   PYR + TEBU fb PYR 
##                   3                   3                   3 
##         TEBU fb PYR          AZO + CYPR         FLUT + FLUX 
##                   3                   4                   4 
##         PROT + TRIF         PYR fb TEBU          FLUS + PYR 
##                   4                   4                   5 
##          FLUT + PYR          FLUX + PYR  PROP + TEBU + TRIF 
##                   5                   5                   5 
##           MYC + PYR         TEBU + TRIF          AZO + FLUT 
##                   6                   6                   7 
##         TEBU + THIO          PYR + TEBU         PROP + TRIF 
##                   9                  13                  20 
##          AZO + PROP 
##                  25
#  only pyr + tebu and azo + prop have >15

Single applications

data.reduced$activeIngClean[data.reduced$activeIngClean=="empty"] <- 
  as.character(data.reduced$active.ingredient.coded[data.reduced$activeIngClean=="empty"])
#     Clean up so labels are consistent (e.g., "pyr" vs "pyra")
data.reduced$activeIngClean[data.reduced$activeIngClean=="pyr"] <- "PYR"
data.reduced$activeIngClean[data.reduced$activeIngClean=="pyraclostrobin"] <- "PYR"
data.reduced$activeIngClean[data.reduced$activeIngClean=="pyro"] <- "PYR"
data.reduced$activeIngClean[data.reduced$activeIngClean=="teb"] <- "TEBU"
data.reduced$activeIngClean[data.reduced$activeIngClean=="tetr"] <- "TETR"
data.reduced$activeIngClean[data.reduced$activeIngClean=="thi"] <- "THIO"
data.reduced$activeIngClean[data.reduced$activeIngClean==""] <- "unknown"
data.reduced$activeIngClean[data.reduced$activeIngClean=="cyp"] <- "CYPR"
data.reduced$activeIngClean[data.reduced$activeIngClean=="tebu "] <- "TEBU"
data.reduced$activeIngClean[data.reduced$active.ingredient.coded=="tria"] <- "TEBU"
#     Check progress
sort(table(data.reduced$activeIngClean))
## 
##    febu    FLUS    met     THIO    chlo     cop    CYPR     eth   other 
##       1       1       1       1       2       2       2       2       2 
##    PROP    trif     org     sul     AZO    pico    prot    cypr    FLUT 
##       2       2       3       3       4       4       4       5       6 
##     gly    flus     PYR    thio     MYC     oth    tebu unknown     azo 
##       6       7       7       9      14      14      16      18      25 
##    TETR    TEBU    dual    pyra    flut   mixed 
##      37      39      46      47      60     174

Convert to capital letters

data.reduced$activeIngClean <- toupper(data.reduced$activeIngClean) 
sort(table(data.reduced$activeIngClean))
## 
##    FEBU    MET     CHLO     COP     ETH   OTHER    PROP    TRIF     ORG 
##       1       1       2       2       2       2       2       2       3 
##     SUL    PICO    PROT     GLY    CYPR     PYR    FLUS    THIO     MYC 
##       3       4       4       6       7       7       8      10      14 
##     OTH UNKNOWN     AZO    TETR    DUAL    PYRA    TEBU    FLUT   MIXED 
##      14      18      29      37      46      47      55      66     174
data.reduced$activeIngClean[data.reduced$activeIngClean=="PYRA"] <- "PYR"
data.reduced$activeIngClean[data.reduced$activeIngClean=="FEBU"] <- "FENB"

Class of fungicide

Clean up labels to be consistent

# Table to see how it looks as is
table(data.reduced$class.code)
## 
##                             chloronitrile       copper sulfate 
##                    1                    2                    1 
##            herbicide             mancozeb          metconazole 
##                    6                    1                    1 
##                  mma                  myc                other 
##                  220                    2                   31 
##               other           strobilurin         strobilurin  
##                    1                   78                    4 
##          strobulurin                 tebu          thiophanate 
##                    8                    1                    9 
## triaz+AL384:AM384ole             triazole              unknown 
##                    1                  188                   11
# Start with "empty"
data.reduced$classClean <- "empty"
# Clean up labels
data.reduced$classClean[data.reduced$class.code==""] <- "unknown"
data.reduced$classClean[data.reduced$class.code=="other "] <- "other"
data.reduced$classClean[data.reduced$class.code=="strobilurin "] <- "strobilurin"
data.reduced$classClean[data.reduced$class.code=="strobulurin"] <- "strobilurin"
data.reduced$classClean[data.reduced$class.code=="triaz+AL384:AM384ole"] <- "triazole"
data.reduced$classClean[data.reduced$class.code=="tebu"] <- "strobilurin"
# Fill in the rest
data.reduced$classClean[data.reduced$classClean=="empty"] <- 
  as.character(data.reduced$class.code[data.reduced$classClean=="empty"])
# Check with table
sort(table(data.reduced$classClean))
## 
## copper sulfate       mancozeb    metconazole  chloronitrile            myc 
##              1              1              1              2              2 
##      herbicide    thiophanate        unknown          other    strobilurin 
##              6              9             12             32             91 
##       triazole            mma 
##            189            220
# View relation between classes and active ingredients
summaryBy(FID~activeIngClean+classClean,data = data.reduced,FUN=length)
##    activeIngClean     classClean FID.length
## 1             AZO    strobilurin         28
## 2             AZO       triazole          1
## 3            CHLO  chloronitrile          2
## 4             COP copper sulfate          1
## 5             COP          other          1
## 6            CYPR       triazole          7
## 7            DUAL            mma         44
## 8            DUAL    strobilurin          2
## 9             ETH          other          2
## 10           FENB       triazole          1
## 11           FLUS       triazole          8
## 12           FLUT       triazole         66
## 13            GLY      herbicide          6
## 14           MET     metconazole          1
## 15          MIXED            mma        166
## 16          MIXED          other          1
## 17          MIXED       triazole          6
## 18          MIXED        unknown          1
## 19            MYC            mma          3
## 20            MYC            myc          2
## 21            MYC       triazole          9
## 22            ORG          other          3
## 23            OTH       mancozeb          1
## 24            OTH          other         13
## 25          OTHER          other          1
## 26          OTHER        unknown          1
## 27           PICO    strobilurin          4
## 28           PROP       triazole          2
## 29           PROT       triazole          4
## 30            PYR            mma          4
## 31            PYR    strobilurin         50
## 32            SUL          other          3
## 33           TEBU            mma          2
## 34           TEBU    strobilurin          1
## 35           TEBU       triazole         52
## 36           TETR    strobilurin          4
## 37           TETR       triazole         33
## 38           THIO            mma          1
## 39           THIO    thiophanate          9
## 40           TRIF    strobilurin          2
## 41        UNKNOWN          other          8
## 42        UNKNOWN        unknown         10
# Fix the classes
data.reduced$classClean[data.reduced$activeIngClean=="AZO"] <- "strobilurin"
data.reduced$classClean[data.reduced$activeIngClean=="COP"] <- "copper sulfate"
data.reduced$classClean[data.reduced$activeIngClean=="MYC"] <- "myc"
data.reduced$classClean[data.reduced$activeIngClean=="PYR"] <- "strobilurin"
data.reduced$classClean[data.reduced$activeIngClean=="TETR"] <- "triazole"
data.reduced$classClean[data.reduced$activeIngClean=="TEBU"] <- "triazole"
data.reduced$classClean[data.reduced$activeIngClean=="THIO"] <- "thiophanate"

# View relation between classes and active ingredients
summaryBy(FID~classClean + activeIngClean,data = data.reduced,FUN=length)
##        classClean activeIngClean FID.length
## 1   chloronitrile           CHLO          2
## 2  copper sulfate            COP          2
## 3       herbicide            GLY          6
## 4        mancozeb            OTH          1
## 5     metconazole           MET           1
## 6             mma           DUAL         44
## 7             mma          MIXED        166
## 8             myc            MYC         14
## 9           other            ETH          2
## 10          other          MIXED          1
## 11          other            ORG          3
## 12          other            OTH         13
## 13          other          OTHER          1
## 14          other            SUL          3
## 15          other        UNKNOWN          8
## 16    strobilurin            AZO         29
## 17    strobilurin           DUAL          2
## 18    strobilurin           PICO          4
## 19    strobilurin            PYR         54
## 20    strobilurin           TRIF          2
## 21    thiophanate           THIO         10
## 22       triazole           CYPR          7
## 23       triazole           FENB          1
## 24       triazole           FLUS          8
## 25       triazole           FLUT         66
## 26       triazole          MIXED          6
## 27       triazole           PROP          2
## 28       triazole           PROT          4
## 29       triazole           TEBU         55
## 30       triazole           TETR         37
## 31        unknown          MIXED          1
## 32        unknown          OTHER          1
## 33        unknown        UNKNOWN         10
# Instead of "mma", specify the mixed classes
head(data.reduced[data.reduced$classClean=="mma",c(10:12,45:48)])
##            trade.name                active.ingredient
## 5   Tebuzol + Topsin        tebuconazole + thiophanate
## 9  Tebuzol  + Topsin        tebuconazole + thiophanate
## 13           Charisma         fluzilazole + famoxidone
## 14           Charisma         fluzilazole + famoxidone
## 21           Stratego propriconizole + trifloxystrobin
## 22           Stratego propriconizole + trifloxystrobin
##    active.ingredient.coded seedWtContLSD activeIngClean combo_complete
## 5                 tebu+thi            NA          MIXED       complete
## 9                 tebu+thi            NA          MIXED       complete
## 13               fluz+famo            NA          MIXED       complete
## 14               fluz+famo            NA          MIXED       complete
## 21             prop + trif           0.5          MIXED       complete
## 22             prop + trif           0.5          MIXED       complete
##    alphaIngred
## 5  TEBU + THIO
## 9  TEBU + THIO
## 13 FAMO + FLUZ
## 14 FAMO + FLUZ
## 21 PROP + TRIF
## 22 PROP + TRIF
data.reduced$classClean[data.reduced$alphaIngred=="TEBU + THIO"] <- "triaz + thio"
data.reduced$classClean[data.reduced$alphaIngred=="PROP + TRIF"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="TEBU + TRIF + OTH"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + PROP"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + CYPR"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="PYR + TEBU"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="TEBU + TRIF"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="PROP + TEBU + TRIF"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="FLUT + PYR"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="FLUS + PYR"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + PROP + TRIF"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + PROP + TEBU"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + FLUT + PROP"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="FLUS + PICO"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="MYC + PYR"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="FLUT + PROP + TRIF"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + DIF"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="PROT + TRIF"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + MYC + PROP"] <- "triaz + strob"
data.reduced$classClean[data.reduced$classClean=="copper sulfate"] <- "inorganic"
data.reduced$classClean[data.reduced$classClean=="mancozeb"] <- "dithiocarbamates"
data.reduced$classClean[data.reduced$classClean=="metconazole"] <- "triazole"
data.reduced$classClean[data.reduced$classClean=="myc"] <- "triazole"
data.reduced$classClean[data.reduced$alphaIngred=="PROP + PROT + TRIF"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="FLUX + PYR"] <- "strobilurin"
data.reduced$classClean[data.reduced$alphaIngred=="FLUT + FLUX"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + FLUT"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + PYR"] <- "strobilurin"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + MYC"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + TEBU"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + PYR"] <- "strobilurin"
data.reduced$classClean[data.reduced$alphaIngred=="FEN + PYR"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="SUL + TEBU"] <- "inorg + triaz"
data.reduced$classClean[data.reduced$alphaIngred=="MYC + PROP + TRIF"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="CHL + TEBU"] <- "chlor + triaz"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + TETR"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="ORTH + TETR"] <- "triaz + other"
data.reduced$classClean[data.reduced$alphaIngred=="CROP + TETR"] <- "triaz + other"
data.reduced$classClean[data.reduced$alphaIngred=="SURF + TEBU"] <- "triaz + other"
data.reduced$classClean[data.reduced$alphaIngred=="COPPER + OTH"] <- "inorg + other"
data.reduced$classClean[data.reduced$alphaIngred=="COPPER + TEBU"] <- "inorg + triaz"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + ORG"] <- "organic + strob"
data.reduced$classClean[data.reduced$alphaIngred=="PYR fb TEBU"] <- "series strob fb triaz"
data.reduced$classClean[data.reduced$alphaIngred=="TEBU fb PYR"] <- "series triaz fb strob"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + PROP fb TEBU"] <- "series triaz + strob fb triaz"
data.reduced$classClean[data.reduced$alphaIngred=="OTH + PYR fb TEBU"] <- "series strob + other fb triaz"
data.reduced$classClean[data.reduced$alphaIngred=="PROP + TRIF fb TEBU"] <- "series triaz + strob fb triaz"
data.reduced$classClean[data.reduced$alphaIngred=="AZO fb TEBU"] <- "series strob fb triaz"
data.reduced$classClean[data.reduced$alphaIngred=="AZO fb MYC"] <- "series strob fb triaz"
data.reduced$classClean[data.reduced$alphaIngred=="AZO fb PYR"] <- "strobilurin"
data.reduced$classClean[data.reduced$alphaIngred=="AZO fb FLUT"] <- "series strob fb triaz"
data.reduced$classClean[data.reduced$alphaIngred=="AZO fb PYR + TEBU"] <- "series strob fb triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="CHL fb CHL + TEBU"] <- "series chlor fb chlor + triaz"
data.reduced$classClean[data.reduced$alphaIngred=="ETH + OTH"] <- "other"
data.reduced$classClean[data.reduced$alphaIngred=="ETH + TEBU"] <- "triaz + other"
data.reduced$classClean[data.reduced$alphaIngred=="MET + PYR"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="CHL fb TEBU"] <- "series chlor fb triaz"
data.reduced$classClean[data.reduced$alphaIngred=="SUL + OTH"] <- "inorg + other"
data.reduced$classClean[data.reduced$alphaIngred=="OTH + THIO"] <- "thio + other"
data.reduced$classClean[data.reduced$alphaIngred=="FLUS + OTH"] <- "triaz + other"
data.reduced$classClean[data.reduced$alphaIngred=="ETH + FLUT"] <- "triaz + other"
data.reduced$classClean[data.reduced$alphaIngred=="PYR + TEBU fb PYR"] <- "series triaz + strob fb strob"
data.reduced$classClean[data.reduced$alphaIngred=="ADJ + TEBU"] <- "triaz + other"
data.reduced$classClean[data.reduced$alphaIngred=="ADJ + PYR"] <- "strob + other"
data.reduced$classClean[data.reduced$alphaIngred=="CARB + FLUS + PICO"] <- "triaz + strob + thio"
data.reduced$classClean[data.reduced$alphaIngred=="MYC + OTH"] <- "triaz + other"
data.reduced$classClean[data.reduced$alphaIngred=="CYPR + PICO"] <- "triaz + strob"
data.reduced$classClean[data.reduced$alphaIngred=="PYR + TEBU fb MYC"] <- "series triaz + strob fb triaz"
data.reduced$classClean[data.reduced$alphaIngred=="THIO fb TEBU"] <- "series thio fb triaz"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + CYPR fb CYPR"] <- "series triaz + strob fb triaz"
data.reduced$classClean[data.reduced$alphaIngred=="PROP + TRIF fb PYR"] <- "series triaz + strob fb strob"
data.reduced$classClean[data.reduced$alphaIngred=="PROP + TRIF fb MYC"] <- "series triaz + strob fb triaz"
data.reduced$classClean[data.reduced$alphaIngred=="PYR + TEBU fb TEBU"] <- "series triaz + strob fb triaz"
data.reduced$classClean[data.reduced$alphaIngred=="PYR + TEBU fb FLUT"] <- "series triaz + strob fb triaz"
data.reduced$classClean[data.reduced$alphaIngred=="AZO + PROP fb MYC"] <- "series triaz + strob fb triaz"
data.reduced$classClean[data.reduced$alphaIngred=="PROP fb MYC"] <- "triazole"
data.reduced$classClean[data.reduced$alphaIngred=="FLUT + THIO"] <- "triaz + thio"
data.reduced$classClean[data.reduced$alphaIngred=="FLUT + OTH"] <- "triaz + other"
data.reduced$classClean[data.reduced$alphaIngred=="PROP fb TEBU"] <- "triazole"
data.reduced$classClean[data.reduced$alphaIngred=="PROP fb FLUT"] <- "triazole"
data.reduced$classClean[data.reduced$alphaIngred=="PROP + TRIF fb FLUT"] <- "series triaz + strob fb triaz"
data.reduced$classClean[data.reduced$trade.name=="Charisma"] <- "triaz + strob"
data.reduced$classClean[data.reduced$classClean=="dithiocarbamates"] <- "other"

# Checking data
head(data.reduced[data.reduced$classClean=="other",c(10:12,45:48)],32)
##                    trade.name                  active.ingredient
## 6                    ACT Plus                              other
## 7                 KFD-21-01 1                              other
## 15                    Manzate                              other
## 57                      BASF1                              other
## 58                      BASF1                              other
## 59                      BASF2                              other
## 60                      BASF2                              other
## 61                      BASF2                              other
## 65                      BASF7                              other
## 106                    LEM 17                              other
## 107                    LEM 17                              other
## 139             carbon buffer                             other 
## 140              liquid boron                              other
## 141                 Restore                                other
## 249       Microthiol Disperss                             sulfer
## 251                 Penncozeb         ethylenebisdithiocarbamate
## 263                 Penncozeb         ethylenebisdithiocarbamate
## 264                Microthiol                             sulfer
## 266            KFD-09-013.6 f                              other
## 268 Penncozeb + KFD-09-013.6f ethylenebisdithiocarbamate + other
## 273                    Ballad                            organic
## 274                    Ballad                            organic
## 275                    Ballad                            organic
## 326                   KFD-09                             unknown
## 328                Microthiol                             sulfer
## 333                  Physpe G                            unknown
## 334                  Physpe G                            unknown
## 335                  Physpe G                            unknown
## 339                  Physpe G                            unknown
## 340                  Physpe G                            unknown
## 341                  Physpe G                            unknown
## 354                biological                            unknown
##     active.ingredient.coded seedWtContLSD activeIngClean combo_complete
## 6                     other            NA          OTHER         single
## 7                       oth            NA            OTH         single
## 15                      oth            NA            OTH         single
## 57                      oth            NA            OTH         single
## 58                      oth            NA            OTH         single
## 59                      oth            NA            OTH         single
## 60                      oth            NA            OTH         single
## 61                      oth            NA            OTH         single
## 65                      oth            NA            OTH         single
## 106                     oth            NA            OTH         single
## 107                     oth            NA            OTH         single
## 139                     oth      1.700000            OTH         single
## 140                     oth      1.700000            OTH         single
## 141                     oth      1.700000            OTH         single
## 249                     sul      0.850485            SUL         single
## 251                     eth      0.850485            ETH         single
## 263                     eth            NA            ETH         single
## 264                     sul            NA            SUL         single
## 266                     oth            NA            OTH         single
## 268                 eth+oth            NA          MIXED       complete
## 273                     org            NA            ORG         single
## 274                     org            NA            ORG         single
## 275                     org            NA            ORG         single
## 326                 unknown            NA        UNKNOWN         single
## 328                     sul            NA            SUL         single
## 333                 unknown            NA        UNKNOWN         single
## 334                 unknown            NA        UNKNOWN         single
## 335                 unknown            NA        UNKNOWN         single
## 339                 unknown            NA        UNKNOWN         single
## 340                 unknown            NA        UNKNOWN         single
## 341                 unknown            NA        UNKNOWN         single
## 354                 unknown            NA        UNKNOWN         single
##     alphaIngred
## 6          <NA>
## 7          <NA>
## 15         <NA>
## 57         <NA>
## 58         <NA>
## 59         <NA>
## 60         <NA>
## 61         <NA>
## 65         <NA>
## 106        <NA>
## 107        <NA>
## 139        <NA>
## 140        <NA>
## 141        <NA>
## 249        <NA>
## 251        <NA>
## 263        <NA>
## 264        <NA>
## 266        <NA>
## 268   ETH + OTH
## 273        <NA>
## 274        <NA>
## 275        <NA>
## 326        <NA>
## 328        <NA>
## 333        <NA>
## 334        <NA>
## 335        <NA>
## 339        <NA>
## 340        <NA>
## 341        <NA>
## 354        <NA>
sort(table(data.reduced$classClean))
## 
## series chlor fb chlor + triaz series strob + other fb triaz 
##                             1                             1 
## series strob fb triaz + strob          triaz + strob + thio 
##                             1                             1 
##                 chlor + triaz                 chloronitrile 
##                             2                             2 
##                 inorg + triaz                     inorganic 
##                             2                             2 
##          series thio fb triaz                  thio + other 
##                             2                             2 
##                 inorg + other               organic + strob 
##                             3                             3 
##         series chlor fb triaz         series triaz fb strob 
##                             3                             3 
##                 strob + other series triaz + strob fb strob 
##                             3                             4 
##                     herbicide         series strob fb triaz 
##                             6                             7 
##                   thiophanate                  triaz + thio 
##                            10                            10 
##                       unknown series triaz + strob fb triaz 
##                            12                            13 
##                 triaz + other                         other 
##                            13                            32 
##                   strobilurin                 triaz + strob 
##                            98                           130 
##                      triazole 
##                           200
sort(table(data.reduced$activeIngClean))
## 
##    FENB    MET     CHLO     COP     ETH   OTHER    PROP    TRIF     ORG 
##       1       1       2       2       2       2       2       2       3 
##     SUL    PICO    PROT     GLY    CYPR    FLUS    THIO     MYC     OTH 
##       3       4       4       6       7       8      10      14      14 
## UNKNOWN     AZO    TETR    DUAL     PYR    TEBU    FLUT   MIXED 
##      18      29      37      46      54      55      66     174
# Final clean up of specific cases
data.reduced$activeIngClean[data.reduced$active.ingredient.coded=="sul"] <- "SUL"
data.reduced$classClean[data.reduced$active.ingredient.coded=="sul"] <- "inorganic"
data.reduced$classClean[data.reduced$trade.name=="Ballad"] <- "organic"
data.reduced$activeIngClean[data.reduced$active.ingredient.coded=="eth"] <- "OTH"
data.reduced$activeIngClean[data.reduced$activeIngClean=="OTH"] <- "other"
data.reduced$activeIngClean[data.reduced$activeIngClean=="OTHER"] <- "other"
data.reduced$activeIngClean[data.reduced$activeIngClean=="UNKNOWN"] <- "other"
data.reduced$classClean[data.reduced$classClean=="unknown"] <- "other"

Growth stages of application

# Examine original data
sort(table(data.reduced$Growth.stage.applied))
## 
##                     3,7                    3fb6            r1 + r3 + r5 
##                       1                       1                       1 
##                   r1 r3                  r1, r3                  r2,r10 
##                       1                       1                       1 
##                  r2,r11                  r2,r12                  r2,r13 
##                       1                       1                       1 
##                  r2,r14                  r2,r15                   r2,r4 
##                       1                       1                       1 
##                   r2,r6                   r2,r7                   r2,r8 
##                       1                       1                       1 
##                   r2,r9                  r2+r10                  r2+r11 
##                       1                       1                       1 
##                  r2+r12                  r2+r13                  r2+r14 
##                       1                       1                       1 
##                   r2+r3                   r2+r4                   r2+r5 
##                       1                       1                       1 
##                   r2+r6                   r2+r7                   r2+r8 
##                       1                       1                       1 
##                   r2+r9               r3  + r5                  r3, r5  
##                       1                       1                       1 
##                r3.5, r5                  r3+21d                  r3+28d 
##                       1                       1                       1 
##                 r5,r5.5 v9,r1,r2,r3,r4,r5,r6,r7                     1+5 
##                       1                       1                       2 
##                r1 fb r3               r2 + r5.5                r3 + r5  
##                       2                       2                       2 
##                r3 fb r5                  r3, r5              r3+21 days 
##                       2                       2                       2 
##              r5 fb r5.5                   v5,r1                   v5+r2 
##                       2                       2                       2 
##                v5+r2+r4                  3 fb 6                 r1 + 14 
##                       2                       3                       3 
##                 r1 + 21                   r4,r6                     3,6 
##                       3                       3                       4 
##                 r1 + r3             r1, r1+ 21d            r3, r3 + 21d 
##                       4                       4                       4 
##                 r3.5,r5                   r4,r5                      R1 
##                       4                       4                       5 
##                      R3                    r3.5                      R5 
##                       5                       5                       5 
##                  r1+21d          v5+r1+r2+r4+r5            r2 + r3 + r5 
##                       6                       6                       7 
##                 r2,r5.5                   r3+r5                     3,5 
##                       8                       8                       9 
##                       5             r2+r4 or r5                      r4 
##                       9                       9                       9 
##                   1+21d                 r1 + r4                r1,r3,r5 
##                      10                      11                      13 
##                   r3,r5                      r1                   r2,r5 
##                      13                      15                      15 
##                      r2                 r2 + r4                 r3 + r5 
##                      22                      24                      25 
##                                         r2 + r5                      r5 
##                      27                      37                      61 
##                      r3 
##                     109
data.reduced$growthStateClean <- "empty"

#   Applied during R1 plus another stage
data.reduced$growthStateClean[grep("^1", data.reduced$Growth.stage.applied)] <- "1+"
data.reduced$growthStateClean[grep("^r1", data.reduced$Growth.stage.applied)] <- "1+"
#   Applied during R1 only
data.reduced$growthStateClean[data.reduced$Growth.stage.applied=="1"|
                                data.reduced$Growth.stage.applied=="r1"|
                                data.reduced$Growth.stage.applied=="R1"] <- "1"
#   Applied during R2 initially plus another stage
data.reduced$growthStateClean[grep("^r2", data.reduced$Growth.stage.applied)] <- "2+"
#   Applied during R2 only
data.reduced$growthStateClean[data.reduced$Growth.stage.applied=="r2"] <- "2"
#   Applied during R3 initially plus another stage
data.reduced$growthStateClean[grep("^3", data.reduced$Growth.stage.applied)] <- "3"
data.reduced$growthStateClean[grep("^r3", data.reduced$Growth.stage.applied)] <- "3"
#   Applied during R3 only
data.reduced$growthStateClean[data.reduced$Growth.stage.applied=="r3"|
                                data.reduced$Growth.stage.applied=="R3"] <- "3"
#   Applied during R4 initially plus another stage (none were 4 only)
data.reduced$growthStateClean[grep("^r4", data.reduced$Growth.stage.applied)] <- "4"
#   Applied during R5
data.reduced$growthStateClean[grep("^r5", data.reduced$Growth.stage.applied)] <- "5"
data.reduced$growthStateClean[grep("^R5", data.reduced$Growth.stage.applied)] <- "5"
data.reduced$growthStateClean[grep("^5", data.reduced$Growth.stage.applied)] <- "5"
#   Applied during V-stage
data.reduced$growthStateClean[grep("^v", data.reduced$Growth.stage.applied)] <- "V"
#   Unknown stage of application
data.reduced$growthStateClean[data.reduced$growthStateClean=="empty"] <- "unknown"
# Check with table
#sort(table(data.reduced$Growth.stage.applied[data.reduced$growthStateClean=="empty"]))
table(data.reduced$growthStateClean)
## 
##       1      1+       2      2+       3       4       5 unknown       V 
##      20      61      22     125     204      16      78      27      13

Number of applications

# Check with table
table(data.reduced$applicationsNumb)
## 
##   1   2   3   5   8 
## 282 254  23   6   1

3. Partition data

Rust data

# Data that had rust severity in percentage originally
    # Column #15 is rustSeverPerc
rust.perc.orig <- data.reduced[!is.na(data.reduced$rustSeverPerc),]
rust.perc.orig$scale <- "Percent"
# Data that had rust severity on scale originally
    # Column #19 is rustSever1-8
rust.scale.orig <- data.reduced[!is.na(data.reduced$rustSever1.8),]
# Data from Lawrence references are actually on 0-10 Scale
scale.1to10.refs <- c(3,4,53,55,62,68,16,41)
rust.scale.orig$scale[rust.scale.orig$ReferenceNumb %in% scale.1to10.refs] <- "Scale 0-10"
# Rest are on 1-8 scale
rust.scale.orig$scale[!rust.scale.orig$ReferenceNumb %in% scale.1to10.refs] <- "Scale 0-8"

# Reference number 18 was recorded on 1-9 scale, but really should be 0-8, 
# so subtract 1
rust.scale.orig$rustSever1.8[rust.scale.orig$ReferenceNumb==18] <- 
  rust.scale.orig$rustSever1.8[rust.scale.orig$ReferenceNumb==18] - 1
rust.scale.orig$rustSever1.8Cont[rust.scale.orig$ReferenceNumb==18] <- 
  rust.scale.orig$rustSever1.8Cont[rust.scale.orig$ReferenceNumb==18] - 1

# Combine back together
rust.data <- rbind(rust.perc.orig, rust.scale.orig)

Yield data

# Data that had yield data
    # Column #35 is yield
yield.data <- rust.data[!is.na(rust.data$yield),] 

100sw data

# Data that had 100sw data
    # Column #39 is 100sw
seedwt.data <- rust.data[!is.na(rust.data$seedWt),] 

4. Standardize effect size information

For rust severity on scale 0-8, convert to percent

For rust severity on scale 0-10, convert to percent

# For treatment groups
rust.data$m1i[rust.data$scale=="Scale 0-8" & 
                rust.data$rustSever1.8 <= 2] <-
                      rust.data$rustSever1.8[rust.data$scale=="Scale 0-8"&
                                               rust.data$rustSever1.8 <= 2]*2.5
rust.data$m1i[rust.data$scale=="Scale 0-8" & 
                rust.data$rustSever1.8 > 2 &
                rust.data$rustSever1.8 <= 4] <- 5 +
                      (rust.data$rustSever1.8[rust.data$scale=="Scale 0-8"&
                                               rust.data$rustSever1.8 > 2 &
                                               rust.data$rustSever1.8 <= 4]-2)*5
rust.data$m1i[rust.data$scale=="Scale 0-8" & 
                rust.data$rustSever1.8 > 4 &
                rust.data$rustSever1.8 <= 6] <- 15 +
                      (rust.data$rustSever1.8[rust.data$scale=="Scale 0-8"&
                                                rust.data$rustSever1.8 > 4 &
                                                rust.data$rustSever1.8 <= 6]-4)*10
rust.data$m1i[rust.data$scale=="Scale 0-8" & 
                rust.data$rustSever1.8 > 6] <- 35 +
                      (rust.data$rustSever1.8[rust.data$scale=="Scale 0-8"&
                                                rust.data$rustSever1.8 > 6]-6)*32.5
# For control groups
rust.data$m2i[rust.data$scale=="Scale 0-8" & 
                rust.data$rustSever1.8Cont <= 2] <-
                      rust.data$rustSever1.8Cont[rust.data$scale=="Scale 0-8"&
                                               rust.data$rustSever1.8Cont <= 2]*2.5
rust.data$m2i[rust.data$scale=="Scale 0-8" & 
                rust.data$rustSever1.8Cont > 2 &
                rust.data$rustSever1.8Cont <= 4] <- 5 +
                      (rust.data$rustSever1.8Cont[rust.data$scale=="Scale 0-8"&
                                                rust.data$rustSever1.8Cont > 2 &
                                                rust.data$rustSever1.8Cont <= 4]-2)*5
rust.data$m2i[rust.data$scale=="Scale 0-8" & 
                rust.data$rustSever1.8Cont > 4 &
                rust.data$rustSever1.8Cont <= 6] <- 15 +
                      (rust.data$rustSever1.8Cont[rust.data$scale=="Scale 0-8"&
                                                rust.data$rustSever1.8Cont > 4 &
                                                rust.data$rustSever1.8Cont <= 6]-4)*10
rust.data$m2i[rust.data$scale=="Scale 0-8" & 
                rust.data$rustSever1.8Cont > 6] <- 35 +
                      (rust.data$rustSever1.8Cont[rust.data$scale=="Scale 0-8"&
                                                rust.data$rustSever1.8Cont > 6]-6)*32.5
# For rust severity on 0-10 scale
rust.data$m1i[rust.data$scale=="Scale 0-10" & 
                rust.data$rustSever1.8 <= 3] <-
  rust.data$rustSever1.8[rust.data$scale=="Scale 0-10"&
                           rust.data$rustSever1.8 <= 3]*(2.5/3)
rust.data$m1i[rust.data$scale=="Scale 0-10" & 
                rust.data$rustSever1.8 > 3 &
                rust.data$rustSever1.8 <= 4] <- 2.5 +
  (rust.data$rustSever1.8[rust.data$scale=="Scale 0-10" & 
                           rust.data$rustSever1.8 > 3 &
                           rust.data$rustSever1.8 <= 4]-3)*2.5
rust.data$m1i[rust.data$scale=="Scale 0-10" & 
                rust.data$rustSever1.8 > 4 &
                rust.data$rustSever1.8 <= 6] <- 5 +
  (rust.data$rustSever1.8[rust.data$scale=="Scale 0-10" & 
                           rust.data$rustSever1.8 > 4 &
                           rust.data$rustSever1.8 <= 6]-4)*5
rust.data$m1i[rust.data$scale=="Scale 0-10" & 
                rust.data$rustSever1.8 > 6 &
                rust.data$rustSever1.8 <= 8] <- 15 +
  (rust.data$rustSever1.8[rust.data$scale=="Scale 0-10" & 
                           rust.data$rustSever1.8 > 6 &
                           rust.data$rustSever1.8 <= 8]-6)*10
rust.data$m1i[rust.data$scale=="Scale 0-10" & 
                rust.data$rustSever1.8 > 8] <- 35 +
  (rust.data$rustSever1.8[rust.data$scale=="Scale 0-10" & 
                            rust.data$rustSever1.8 > 8]-8)*32.5
# Control
rust.data$m2i[rust.data$scale=="Scale 0-10" & 
                rust.data$rustSever1.8Cont <= 3] <-
  rust.data$rustSever1.8Cont[rust.data$scale=="Scale 0-10"&
                           rust.data$rustSever1.8Cont <= 3]*(2.5/3)
rust.data$m2i[rust.data$scale=="Scale 0-10" & 
                rust.data$rustSever1.8Cont > 3 &
                rust.data$rustSever1.8Cont <= 4] <- 2.5 +
  (rust.data$rustSever1.8Cont[rust.data$scale=="Scale 0-10" & 
                            rust.data$rustSever1.8Cont > 3 &
                            rust.data$rustSever1.8Cont <= 4]-3)*2.5
rust.data$m2i[rust.data$scale=="Scale 0-10" & 
                rust.data$rustSever1.8Cont > 4 &
                rust.data$rustSever1.8Cont <= 6] <- 5 +
  (rust.data$rustSever1.8Cont[rust.data$scale=="Scale 0-10" & 
                            rust.data$rustSever1.8Cont > 4 &
                            rust.data$rustSever1.8Cont <= 6]-4)*5
rust.data$m2i[rust.data$scale=="Scale 0-10" & 
                rust.data$rustSever1.8Cont > 6 &
                rust.data$rustSever1.8Cont <= 8] <- 15 +
  (rust.data$rustSever1.8Cont[rust.data$scale=="Scale 0-10" & 
                            rust.data$rustSever1.8Cont > 6 &
                            rust.data$rustSever1.8Cont <= 8]-6)*10
rust.data$m2i[rust.data$scale=="Scale 0-10" & 
                rust.data$rustSever1.8Cont > 8] <- 35 +
  (rust.data$rustSever1.8Cont[rust.data$scale=="Scale 0-10" & 
                            rust.data$rustSever1.8Cont > 8]-8)*32.5
# For rust severity in percent originally
rust.data$m1i[rust.data$scale=="Percent"] <- 
  rust.data$rustSeverPerc[rust.data$scale=="Percent"]
rust.data$m2i[rust.data$scale=="Percent"] <- 
  rust.data$rustSeverPercCont[rust.data$scale=="Percent"]
# Sample sizes
rust.data$n1i <- rust.data$n2i <- rust.data$replications

# Just control plant severity and FID from rust dataset
rust.data.m2i <- rust.data[,c("FID","m2i")]
colnames(rust.data.m2i) <- c("FIDrust","rust.m2i")

Yield data

yield.data$yield.kg.ha <- yield.data$yield*67.25 # convert to kg ha-1
yield.data$yieldCont.kg.ha <- yield.data$yieldCont*67.25 # convert to kg ha-1
  # conversion info from https://www.extension.iastate.edu/agdm/wholefarm/html/c6-80.html
yield.data$m1i <- yield.data$yield.kg.ha # Yield for treatment group
yield.data$m2i <- yield.data$yieldCont.kg.ha # Yield for control group
yield.data$n1i <- yield.data$n2i <- yield.data$replications

# Add control rust severity to yield dataset
yield.data <- merge(yield.data, 
                         rust.data.m2i, 
                         all.x = T, 
                         by.x = "FID", 
                         by.y = "FIDrust")

100 seed weight data

seedwt.data$m1i <- seedwt.data$seedWt # Yield for treatment group
seedwt.data$m2i <- seedwt.data$seedWtCont # Yield for control group
seedwt.data$n1i <- seedwt.data$n2i <- seedwt.data$replications

# Add control rust severity to seedwt dataset
seedwt.data <- merge(seedwt.data, 
                     rust.data.m2i, 
                     all.x = T, 
                     by.x = "FID", 
                     by.y = "FIDrust")

5. Take out categorical moderators with records < 15 from < 5 studies

Rust data

Take out values of control rust severity <5%

too.low.pressure <- rust.data$ReferenceNumb[rust.data$m2i<5] 
rust.data <- rust.data[!rust.data$ReferenceNumb %in% too.low.pressure,]
yield.data <- yield.data[!yield.data$ReferenceNumb %in% too.low.pressure,]
seedwt.data <- seedwt.data[!seedwt.data$ReferenceNumb %in% too.low.pressure,]

Active ingredients

sort(table(rust.data$activeIngClean))
## 
##  PROP   COP  CYPR   ORG   SUL   MYC  PICO  THIO   AZO   GLY  FLUS  TETR 
##     1     2     2     3     3     4     4     5     6     6     7    10 
##  DUAL other   PYR  TEBU  FLUT MIXED 
##    18    24    25    31    40   129
analyze.ai <- c("DUAL", "PYR","TEBU","FLUT","MIXED")
rust.data$category_ai[rust.data$activeIngClean %in% analyze.ai] <- 
  rust.data$activeIngClean[rust.data$activeIngClean %in% analyze.ai]
table(rust.data$category_ai)
## 
##  DUAL  FLUT MIXED   PYR  TEBU 
##    18    40   129    25    31
# now check for 5+ studies for each category
summaryBy(FID~category_ai+ReferenceNumb, 
          data=rust.data[! is.na(rust.data$category_ai),],
          FUN=length)
##    category_ai ReferenceNumb FID.length
## 1         DUAL            36          1
## 2         DUAL            43          4
## 3         DUAL            65          2
## 4         DUAL            74         11
## 5         FLUT            16          2
## 6         FLUT            30          1
## 7         FLUT            31          1
## 8         FLUT            34          2
## 9         FLUT            35          6
## 10        FLUT            37          1
## 11        FLUT            45         14
## 12        FLUT            54          1
## 13        FLUT            65          2
## 14        FLUT            66         10
## 15       MIXED             3          2
## 16       MIXED             4          2
## 17       MIXED             9          6
## 18       MIXED            16          5
## 19       MIXED            18          2
## 20       MIXED            21          5
## 21       MIXED            22          3
## 22       MIXED            23         11
## 23       MIXED            30          5
## 24       MIXED            31          5
## 25       MIXED            32          4
## 26       MIXED            34          5
## 27       MIXED            35          6
## 28       MIXED            36         10
## 29       MIXED            37          9
## 30       MIXED            38          6
## 31       MIXED            39          4
## 32       MIXED            40          3
## 33       MIXED            41          4
## 34       MIXED            42          3
## 35       MIXED            43          5
## 36       MIXED            45          2
## 37       MIXED            46          1
## 38       MIXED            53          2
## 39       MIXED            54          3
## 40       MIXED            55          4
## 41       MIXED            62          3
## 42       MIXED            65          3
## 43       MIXED            66          2
## 44       MIXED            68          4
## 45         PYR             1          1
## 46         PYR             3          1
## 47         PYR             9          1
## 48         PYR            16          1
## 49         PYR            22          1
## 50         PYR            23          1
## 51         PYR            30          1
## 52         PYR            31          1
## 53         PYR            36          6
## 54         PYR            37          1
## 55         PYR            39          1
## 56         PYR            41          1
## 57         PYR            43          3
## 58         PYR            47          2
## 59         PYR            54          1
## 60         PYR            55          1
## 61         PYR            65          1
## 62        TEBU             3          1
## 63        TEBU             4          1
## 64        TEBU             9          2
## 65        TEBU            16          1
## 66        TEBU            18          1
## 67        TEBU            21          1
## 68        TEBU            30          1
## 69        TEBU            31          1
## 70        TEBU            34          2
## 71        TEBU            36          6
## 72        TEBU            37          1
## 73        TEBU            39          2
## 74        TEBU            41          1
## 75        TEBU            43          3
## 76        TEBU            45          1
## 77        TEBU            46          1
## 78        TEBU            55          1
## 79        TEBU            62          1
## 80        TEBU            65          2
## 81        TEBU            66          1
rust.data$category_ai[rust.data$category_ai=="DUAL"] <- NA

Class

sort(table(rust.data$classClean))
## 
##                 chlor + triaz                  thio + other 
##                             1                             1 
##          triaz + strob + thio                 inorg + triaz 
##                             1                             2 
##                 inorg + other                       organic 
##                             3                             3 
##               organic + strob         series strob fb triaz 
##                             3                             3 
##         series triaz fb strob                     inorganic 
##                             3                             5 
##                   thiophanate                     herbicide 
##                             5                             6 
##                  triaz + thio series triaz + strob fb triaz 
##                             6                             7 
##                 triaz + other                         other 
##                             9                            26 
##                   strobilurin                 triaz + strob 
##                            40                            98 
##                      triazole 
##                            98
analyze.class <- c("strobilurin","triaz + strob","triazole")
rust.data$category_class[rust.data$classClean %in% analyze.class] <- 
  rust.data$classClean[rust.data$classClean %in% analyze.class]
table(rust.data$category_class)
## 
##   strobilurin triaz + strob      triazole 
##            40            98            98
# now check for 5+ studies for each category
summaryBy(FID~category_class+ReferenceNumb, 
          data=rust.data[! is.na(rust.data$category_class),],
          FUN=length)
##    category_class ReferenceNumb FID.length
## 1     strobilurin             1          1
## 2     strobilurin             3          1
## 3     strobilurin             9          1
## 4     strobilurin            16          2
## 5     strobilurin            22          4
## 6     strobilurin            23          1
## 7     strobilurin            30          2
## 8     strobilurin            31          2
## 9     strobilurin            34          3
## 10    strobilurin            36          6
## 11    strobilurin            37          3
## 12    strobilurin            39          1
## 13    strobilurin            41          1
## 14    strobilurin            42          1
## 15    strobilurin            43          3
## 16    strobilurin            47          2
## 17    strobilurin            54          2
## 18    strobilurin            55          2
## 19    strobilurin            65          1
## 20    strobilurin            68          1
## 21  triaz + strob             4          2
## 22  triaz + strob             9          4
## 23  triaz + strob            16          5
## 24  triaz + strob            18          2
## 25  triaz + strob            21          5
## 26  triaz + strob            22          2
## 27  triaz + strob            23         11
## 28  triaz + strob            30          4
## 29  triaz + strob            31          4
## 30  triaz + strob            32          4
## 31  triaz + strob            34          3
## 32  triaz + strob            35          6
## 33  triaz + strob            36         10
## 34  triaz + strob            37          7
## 35  triaz + strob            38          6
## 36  triaz + strob            40          1
## 37  triaz + strob            43          5
## 38  triaz + strob            45          1
## 39  triaz + strob            53          1
## 40  triaz + strob            54          3
## 41  triaz + strob            55          3
## 42  triaz + strob            62          1
## 43  triaz + strob            65          1
## 44  triaz + strob            66          1
## 45  triaz + strob            68          4
## 46  triaz + strob            74          2
## 47       triazole             3          1
## 48       triazole             4          3
## 49       triazole             9          2
## 50       triazole            16          6
## 51       triazole            18          1
## 52       triazole            21          1
## 53       triazole            30          3
## 54       triazole            31          3
## 55       triazole            34          6
## 56       triazole            35          6
## 57       triazole            36          6
## 58       triazole            37          4
## 59       triazole            39          2
## 60       triazole            40          1
## 61       triazole            41          1
## 62       triazole            43          3
## 63       triazole            45         15
## 64       triazole            46          1
## 65       triazole            53          1
## 66       triazole            54          4
## 67       triazole            55          4
## 68       triazole            62          1
## 69       triazole            65          8
## 70       triazole            66         11
## 71       triazole            74          4

R-stage

sort(table(rust.data$growthStateClean))
## 
##       2       V       1       4 unknown       5      1+      2+       3 
##       8      10      11      16      18      25      51      75     106
analyze.rstage <- c("4","5","1+","2+","3")
rust.data$category_rstage[rust.data$growthStateClean %in% analyze.rstage] <- 
  rust.data$growthStateClean[rust.data$growthStateClean %in% analyze.rstage]
table(rust.data$category_rstage)
## 
##  1+  2+   3   4   5 
##  51  75 106  16  25
# now check for 5+ studies for each category
summaryBy(FID~category_rstage+ReferenceNumb, 
          data=rust.data[! is.na(rust.data$category_rstage),],
          FUN=length)
##    category_rstage ReferenceNumb FID.length
## 1               1+             4          6
## 2               1+            35          4
## 3               1+            36          6
## 4               1+            38          6
## 5               1+            39         11
## 6               1+            43          3
## 7               1+            46          5
## 8               1+            55         10
## 9               2+            18          3
## 10              2+            23         12
## 11              2+            37         15
## 12              2+            40          4
## 13              2+            41         11
## 14              2+            42          7
## 15              2+            45          9
## 16              2+            47          2
## 17              2+            74         12
## 18               3             3          7
## 19               3             9          9
## 20               3            16         13
## 21               3            21          5
## 22               3            22          9
## 23               3            32          2
## 24               3            34          9
## 25               3            35          4
## 26               3            36          9
## 27               3            43          6
## 28               3            53          6
## 29               3            62          7
## 30               3            65         15
## 31               3            68          5
## 32               4             1          3
## 33               4            66         13
## 34               5            21          1
## 35               5            32          2
## 36               5            34          3
## 37               5            36          4
## 38               5            43          3
## 39               5            54          9
## 40               5            65          3
rust.data$category_rstage[rust.data$category_rstage=="4"] <- NA

Applications

sort(table(rust.data$applicationsNumb))
## 
##   5   3   1   2 
##   6  15 129 170
rust.data$number_applications[rust.data$applicationsNumb!=5] <- 
  rust.data$applicationsNumb[rust.data$applicationsNumb!=5]
table(rust.data$number_applications)
## 
##   1   2   3 
## 129 170  15
# now check for 5+ studies for each category
summaryBy(FID~number_applications+ReferenceNumb, 
          data=rust.data[! is.na(rust.data$number_applications),],
          FUN=length)
##    number_applications ReferenceNumb FID.length
## 1                    1             1          3
## 2                    1             9          9
## 3                    1            16          8
## 4                    1            21          6
## 5                    1            30          9
## 6                    1            31          9
## 7                    1            32          4
## 8                    1            34         12
## 9                    1            35          4
## 10                   1            36         12
## 11                   1            43          9
## 12                   1            45          8
## 13                   1            54          9
## 14                   1            62          1
## 15                   1            65         16
## 16                   1            66          6
## 17                   1            68          4
## 18                   2             3          7
## 19                   2             4          6
## 20                   2            16          5
## 21                   2            18          3
## 22                   2            22          9
## 23                   2            23         12
## 24                   2            35          8
## 25                   2            36         10
## 26                   2            37         15
## 27                   2            38          6
## 28                   2            39         11
## 29                   2            40          4
## 30                   2            41         11
## 31                   2            43          6
## 32                   2            45          9
## 33                   2            47          4
## 34                   2            53          6
## 35                   2            55         10
## 36                   2            62          6
## 37                   2            65          2
## 38                   2            66          7
## 39                   2            68          1
## 40                   2            74         12
## 41                   3            36          1
## 42                   3            42          7
## 43                   3            46          5
## 44                   3            47          2
rust.data$number_applications[rust.data$number_applications==3] <- NA

Disease strength of untreated check (i.e., disease pressure)

rust.data$category_pressure[rust.data$m2i<40] <- "low"
rust.data$category_pressure[rust.data$m2i>=40&
                              rust.data$m2i<70] <- "medium"
rust.data$category_pressure[rust.data$m2i>=70] <- "high"
table(rust.data$category_pressure)
## 
##   high    low medium 
##    167    109     44
# Store ReferenceNumbs from each for categorizing yield/100sw data
index.low <- rust.data$ReferenceNumb[rust.data$category_pressure=="low"]
index.med <- rust.data$ReferenceNumb[rust.data$category_pressure=="medium"]
index.high <- rust.data$ReferenceNumb[rust.data$category_pressure=="high"]

Year of study

table(rust.data$studyYear)
## 
## 2005 2006 2007 2008 2012 2013 
##   19  144   53   53   12   39
rust.data$category_year[rust.data$studyYear!="2012"] <- 
  rust.data$studyYear[rust.data$studyYear!="2012"]
summaryBy(FID~category_year+ReferenceNumb, 
          data=rust.data[! is.na(rust.data$category_year),],
          FUN=length)
##    category_year ReferenceNumb FID.length
## 1           2005             4          6
## 2           2005            21          6
## 3           2005            42          7
## 4           2006            18          3
## 5           2006            36         23
## 6           2006            37         15
## 7           2006            38          6
## 8           2006            39         11
## 9           2006            40          4
## 10          2006            41         11
## 11          2006            43         15
## 12          2006            45         17
## 13          2006            46          5
## 14          2006            47         12
## 15          2006            55         10
## 16          2006            74         12
## 17          2007             1          3
## 18          2007             3          7
## 19          2007             9          9
## 20          2007            23         12
## 21          2007            53          6
## 22          2007            54          9
## 23          2007            62          7
## 24          2008            16         13
## 25          2008            22          9
## 26          2008            65         18
## 27          2008            66         13
## 28          2013            30          9
## 29          2013            31          9
## 30          2013            32          4
## 31          2013            34         12
## 32          2013            68          5
rust.data$category_year[rust.data$studyYear=="2008"|
                          rust.data$studyYear=="2005"] <- NA

Yield data

Applications

sort(table(yield.data$applicationsNumb))
## 
##   5   3   1   2 
##   3  14 111 160
yield.data$number_applications[yield.data$applicationsNumb==1|yield.data$applicationsNumb==2] <- 
  yield.data$applicationsNumb[yield.data$applicationsNumb==1|yield.data$applicationsNumb==2]
table(yield.data$number_applications)
## 
##   1   2 
## 111 160
# now check for 5+ studies for each category
summaryBy(FID~number_applications+ReferenceNumb, 
          data=yield.data[! is.na(yield.data$number_applications),],
          FUN=length)
##    number_applications ReferenceNumb FID.length
## 1                    1             1          3
## 2                    1             9          9
## 3                    1            16          8
## 4                    1            21          6
## 5                    1            30          9
## 6                    1            31          9
## 7                    1            32          4
## 8                    1            34         12
## 9                    1            35          4
## 10                   1            36         12
## 11                   1            45          8
## 12                   1            62          1
## 13                   1            65         16
## 14                   1            66          6
## 15                   1            68          4
## 16                   2             3          7
## 17                   2             4          6
## 18                   2            16          5
## 19                   2            18          3
## 20                   2            22          9
## 21                   2            23         12
## 22                   2            35          8
## 23                   2            36         10
## 24                   2            37         15
## 25                   2            38          6
## 26                   2            39         11
## 27                   2            40          4
## 28                   2            41         10
## 29                   2            45          9
## 30                   2            47          2
## 31                   2            53          6
## 32                   2            55          9
## 33                   2            62          6
## 34                   2            65          2
## 35                   2            66          7
## 36                   2            68          1
## 37                   2            74         12

R-stage

sort(table(yield.data$growthStateClean))
## 
##       V       1       2       5       4 unknown      1+      2+       3 
##       5       8       8      13      16      18      47      73     100
yield.data$category_rstage[yield.data$growthStateClean %in% analyze.rstage] <- 
  yield.data$growthStateClean[yield.data$growthStateClean %in% analyze.rstage]
table(yield.data$category_rstage)
## 
##  1+  2+   3   4   5 
##  47  73 100  16  13
# now check for 5+ studies for each category
summaryBy(FID~category_rstage+ReferenceNumb, 
          data=yield.data[! is.na(yield.data$category_rstage),],
          FUN=length)
##    category_rstage ReferenceNumb FID.length
## 1               1+             4          6
## 2               1+            35          4
## 3               1+            36          6
## 4               1+            38          6
## 5               1+            39         11
## 6               1+            46          5
## 7               1+            55          9
## 8               2+            18          3
## 9               2+            23         12
## 10              2+            37         15
## 11              2+            40          4
## 12              2+            41         10
## 13              2+            42          7
## 14              2+            45          9
## 15              2+            47          1
## 16              2+            74         12
## 17               3             3          7
## 18               3             9          9
## 19               3            16         13
## 20               3            21          5
## 21               3            22          9
## 22               3            32          2
## 23               3            34          9
## 24               3            35          4
## 25               3            36          9
## 26               3            53          6
## 27               3            62          7
## 28               3            65         15
## 29               3            68          5
## 30               4             1          3
## 31               4            66         13
## 32               5            21          1
## 33               5            32          2
## 34               5            34          3
## 35               5            36          4
## 36               5            65          3
yield.data$category_rstage[yield.data$category_rstage=="4"] <- NA

Active ingredients

sort(table(yield.data$activeIngClean))
## 
##  PROP   COP  CYPR   MYC   ORG   SUL   GLY  PICO   AZO  THIO  FLUS  TETR 
##     1     2     2     3     3     3     4     4     5     5     6     9 
##  DUAL   PYR other  TEBU  FLUT MIXED 
##    14    20    21    28    39   119
analyze.ai <- c("PYR","TEBU","FLUT","MIXED")
yield.data$category_ai[yield.data$activeIngClean %in% analyze.ai] <- 
  yield.data$activeIngClean[yield.data$activeIngClean %in% analyze.ai]
sort(table(yield.data$category_ai))
## 
##   PYR  TEBU  FLUT MIXED 
##    20    28    39   119
# now check for 5+ studies for each category
summaryBy(FID~category_ai+ReferenceNumb, 
          data=yield.data[! is.na(yield.data$category_ai),],
          FUN=length)
##    category_ai ReferenceNumb FID.length
## 1         FLUT            16          2
## 2         FLUT            30          1
## 3         FLUT            31          1
## 4         FLUT            34          2
## 5         FLUT            35          6
## 6         FLUT            37          1
## 7         FLUT            45         14
## 8         FLUT            65          2
## 9         FLUT            66         10
## 10       MIXED             3          2
## 11       MIXED             4          2
## 12       MIXED             9          6
## 13       MIXED            16          5
## 14       MIXED            18          2
## 15       MIXED            21          5
## 16       MIXED            22          3
## 17       MIXED            23         11
## 18       MIXED            30          5
## 19       MIXED            31          5
## 20       MIXED            32          4
## 21       MIXED            34          5
## 22       MIXED            35          6
## 23       MIXED            36         10
## 24       MIXED            37          9
## 25       MIXED            38          6
## 26       MIXED            39          4
## 27       MIXED            40          3
## 28       MIXED            41          3
## 29       MIXED            42          3
## 30       MIXED            45          2
## 31       MIXED            46          1
## 32       MIXED            53          2
## 33       MIXED            55          3
## 34       MIXED            62          3
## 35       MIXED            65          3
## 36       MIXED            66          2
## 37       MIXED            68          4
## 38         PYR             1          1
## 39         PYR             3          1
## 40         PYR             9          1
## 41         PYR            16          1
## 42         PYR            22          1
## 43         PYR            23          1
## 44         PYR            30          1
## 45         PYR            31          1
## 46         PYR            36          6
## 47         PYR            37          1
## 48         PYR            39          1
## 49         PYR            41          1
## 50         PYR            47          1
## 51         PYR            55          1
## 52         PYR            65          1
## 53        TEBU             3          1
## 54        TEBU             4          1
## 55        TEBU             9          2
## 56        TEBU            16          1
## 57        TEBU            18          1
## 58        TEBU            21          1
## 59        TEBU            30          1
## 60        TEBU            31          1
## 61        TEBU            34          2
## 62        TEBU            36          6
## 63        TEBU            37          1
## 64        TEBU            39          2
## 65        TEBU            41          1
## 66        TEBU            45          1
## 67        TEBU            46          1
## 68        TEBU            55          1
## 69        TEBU            62          1
## 70        TEBU            65          2
## 71        TEBU            66          1

Class

sort(table(yield.data$classClean))
## 
##                 chlor + triaz         series strob fb triaz 
##                             1                             1 
##         series triaz fb strob          triaz + strob + thio 
##                             1                             1 
##                 inorg + triaz                 inorg + other 
##                             2                             3 
##                       organic               organic + strob 
##                             3                             3 
##                     herbicide                     inorganic 
##                             4                             5 
##                   thiophanate                  triaz + thio 
##                             5                             6 
## series triaz + strob fb triaz                 triaz + other 
##                             7                             9 
##                         other                   strobilurin 
##                            23                            34 
##                 triaz + strob                      triazole 
##                            89                            91
yield.data$category_class[yield.data$classClean %in% analyze.class] <- 
  yield.data$classClean[yield.data$classClean %in% analyze.class]
sort(table(yield.data$category_class))
## 
##   strobilurin triaz + strob      triazole 
##            34            89            91
# now check for 5+ studies for each category
summaryBy(FID~category_class+ReferenceNumb, 
          data=yield.data[! is.na(yield.data$category_class),],
          FUN=length)
##    category_class ReferenceNumb FID.length
## 1     strobilurin             1          1
## 2     strobilurin             3          1
## 3     strobilurin             9          1
## 4     strobilurin            16          2
## 5     strobilurin            22          4
## 6     strobilurin            23          1
## 7     strobilurin            30          2
## 8     strobilurin            31          2
## 9     strobilurin            34          3
## 10    strobilurin            36          6
## 11    strobilurin            37          3
## 12    strobilurin            39          1
## 13    strobilurin            41          1
## 14    strobilurin            42          1
## 15    strobilurin            47          1
## 16    strobilurin            55          2
## 17    strobilurin            65          1
## 18    strobilurin            68          1
## 19  triaz + strob             4          2
## 20  triaz + strob             9          4
## 21  triaz + strob            16          5
## 22  triaz + strob            18          2
## 23  triaz + strob            21          5
## 24  triaz + strob            22          2
## 25  triaz + strob            23         11
## 26  triaz + strob            30          4
## 27  triaz + strob            31          4
## 28  triaz + strob            32          4
## 29  triaz + strob            34          3
## 30  triaz + strob            35          6
## 31  triaz + strob            36         10
## 32  triaz + strob            37          7
## 33  triaz + strob            38          6
## 34  triaz + strob            40          1
## 35  triaz + strob            45          1
## 36  triaz + strob            53          1
## 37  triaz + strob            55          2
## 38  triaz + strob            62          1
## 39  triaz + strob            65          1
## 40  triaz + strob            66          1
## 41  triaz + strob            68          4
## 42  triaz + strob            74          2
## 43       triazole             3          1
## 44       triazole             4          3
## 45       triazole             9          2
## 46       triazole            16          6
## 47       triazole            18          1
## 48       triazole            21          1
## 49       triazole            30          3
## 50       triazole            31          3
## 51       triazole            34          6
## 52       triazole            35          6
## 53       triazole            36          6
## 54       triazole            37          4
## 55       triazole            39          2
## 56       triazole            40          1
## 57       triazole            41          1
## 58       triazole            45         15
## 59       triazole            46          1
## 60       triazole            53          1
## 61       triazole            55          4
## 62       triazole            62          1
## 63       triazole            65          8
## 64       triazole            66         11
## 65       triazole            74          4

Disease strength of untreated check (i.e., disease pressure)

yield.data$category_pressure[yield.data$ReferenceNumb %in% index.low] <- "low"
yield.data$category_pressure[yield.data$ReferenceNumb %in% index.med] <- "medium"
yield.data$category_pressure[yield.data$ReferenceNumb %in% index.high] <- "high"
table(yield.data$category_pressure)
## 
##   high    low medium 
##    152     94     42

Year of study

table(yield.data$studyYear)
## 
## 2005 2006 2007 2008 2012 2013 
##   19  121   44   53   12   39
yield.data$category_year[yield.data$studyYear!="2012"] <- 
  yield.data$studyYear[yield.data$studyYear!="2012"]
summaryBy(FID~category_year+ReferenceNumb, 
          data=yield.data[! is.na(yield.data$category_year),],
          FUN=length)
##    category_year ReferenceNumb FID.length
## 1           2005             4          6
## 2           2005            21          6
## 3           2005            42          7
## 4           2006            18          3
## 5           2006            36         23
## 6           2006            37         15
## 7           2006            38          6
## 8           2006            39         11
## 9           2006            40          4
## 10          2006            41         10
## 11          2006            45         17
## 12          2006            46          5
## 13          2006            47          6
## 14          2006            55          9
## 15          2006            74         12
## 16          2007             1          3
## 17          2007             3          7
## 18          2007             9          9
## 19          2007            23         12
## 20          2007            53          6
## 21          2007            62          7
## 22          2008            16         13
## 23          2008            22          9
## 24          2008            65         18
## 25          2008            66         13
## 26          2013            30          9
## 27          2013            31          9
## 28          2013            32          4
## 29          2013            34         12
## 30          2013            68          5
yield.data$category_year[yield.data$studyYear=="2008"|
                          yield.data$studyYear=="2005"] <- NA

100-seed weight data

Applications

sort(table(seedwt.data$applicationsNumb))
## 
##  3  2  1 
##  1 64 79
seedwt.data$number_applications[seedwt.data$applicationsNumb!=3] <-
  seedwt.data$applicationsNumb[seedwt.data$applicationsNumb!=3]
table(seedwt.data$number_applications)
## 
##  1  2 
## 79 64
# now check for 5+ studies for each category
summaryBy(FID~number_applications+ReferenceNumb, 
          data=seedwt.data[! is.na(seedwt.data$number_applications),],
          FUN=length)
##    number_applications ReferenceNumb FID.length
## 1                    1             1          3
## 2                    1             9          9
## 3                    1            30          9
## 4                    1            32          4
## 5                    1            34         12
## 6                    1            36         12
## 7                    1            45          8
## 8                    1            65         16
## 9                    1            66          6
## 10                   2            36         10
## 11                   2            37         15
## 12                   2            38          6
## 13                   2            39         11
## 14                   2            40          4
## 15                   2            45          9
## 16                   2            65          2
## 17                   2            66          7

Growth stage

sort(table(seedwt.data$growthStateClean))
## 
##       1       2 unknown       5       4      1+      2+       3 
##       4       8       9      12      16      23      28      44
analyze.rstage <- c("4","1+","2+","3")
seedwt.data$category_rstage[seedwt.data$growthStateClean %in% analyze.rstage] <-
  seedwt.data$growthStateClean[seedwt.data$growthStateClean %in% analyze.rstage]
table(seedwt.data$category_rstage)
## 
## 1+ 2+  3  4 
## 23 28 44 16
# now check for 5+ studies for each category
summaryBy(FID~category_rstage+ReferenceNumb, 
          data=seedwt.data[! is.na(seedwt.data$category_rstage),],
          FUN=length)
##    category_rstage ReferenceNumb FID.length
## 1               1+            36          6
## 2               1+            38          6
## 3               1+            39         11
## 4               2+            37         15
## 5               2+            40          4
## 6               2+            45          9
## 7                3             9          9
## 8                3            32          2
## 9                3            34          9
## 10               3            36          9
## 11               3            65         15
## 12               4             1          3
## 13               4            66         13
seedwt.data$category_rstage[seedwt.data$category_rstage!="3"] <- NA

Active ingredients

sort(table(seedwt.data$activeIngClean))
## 
##   COP  CYPR   SUL  THIO   AZO   GLY  DUAL   MYC other  TETR   PYR  TEBU 
##     1     1     1     1     2     2     3     3     5     6    12    18 
##  FLUT MIXED 
##    30    59
analyze.ai <- c("TEBU","FLUT","MIXED")
seedwt.data$category_ai[seedwt.data$activeIngClean %in% analyze.ai] <- 
  seedwt.data$activeIngClean[seedwt.data$activeIngClean %in% analyze.ai]
table(seedwt.data$category_ai)
## 
##  FLUT MIXED  TEBU 
##    30    59    18
# now check for 5+ studies for each category
summaryBy(FID~category_ai+ReferenceNumb, 
          data=seedwt.data[! is.na(seedwt.data$category_ai),],
          FUN=length)
##    category_ai ReferenceNumb FID.length
## 1         FLUT            30          1
## 2         FLUT            34          2
## 3         FLUT            37          1
## 4         FLUT            45         14
## 5         FLUT            65          2
## 6         FLUT            66         10
## 7        MIXED             9          6
## 8        MIXED            30          5
## 9        MIXED            32          4
## 10       MIXED            34          5
## 11       MIXED            36         10
## 12       MIXED            37          9
## 13       MIXED            38          6
## 14       MIXED            39          4
## 15       MIXED            40          3
## 16       MIXED            45          2
## 17       MIXED            65          3
## 18       MIXED            66          2
## 19        TEBU             9          2
## 20        TEBU            30          1
## 21        TEBU            34          2
## 22        TEBU            36          6
## 23        TEBU            37          1
## 24        TEBU            39          2
## 25        TEBU            45          1
## 26        TEBU            65          2
## 27        TEBU            66          1

Class

sort(table(seedwt.data$classClean))
## 
##                 chlor + triaz         series strob fb triaz 
##                             1                             1 
## series triaz + strob fb triaz         series triaz fb strob 
##                             1                             1 
##                   thiophanate          triaz + strob + thio 
##                             1                             1 
##                     herbicide                 inorg + triaz 
##                             2                             2 
##                     inorganic                  triaz + thio 
##                             2                             2 
##                         other                 triaz + other 
##                             5                             7 
##                   strobilurin                 triaz + strob 
##                            18                            42 
##                      triazole 
##                            58
seedwt.data$category_class[seedwt.data$classClean %in% analyze.class] <- 
  seedwt.data$classClean[seedwt.data$classClean %in% analyze.class]
table(seedwt.data$category_class)
## 
##   strobilurin triaz + strob      triazole 
##            18            42            58
# now check for 5+ studies for each category
summaryBy(FID~category_class+ReferenceNumb, 
          data=seedwt.data[! is.na(seedwt.data$category_class),],
          FUN=length)
##    category_class ReferenceNumb FID.length
## 1     strobilurin             1          1
## 2     strobilurin             9          1
## 3     strobilurin            30          2
## 4     strobilurin            34          3
## 5     strobilurin            36          6
## 6     strobilurin            37          3
## 7     strobilurin            39          1
## 8     strobilurin            65          1
## 9   triaz + strob             9          4
## 10  triaz + strob            30          4
## 11  triaz + strob            32          4
## 12  triaz + strob            34          3
## 13  triaz + strob            36         10
## 14  triaz + strob            37          7
## 15  triaz + strob            38          6
## 16  triaz + strob            40          1
## 17  triaz + strob            45          1
## 18  triaz + strob            65          1
## 19  triaz + strob            66          1
## 20       triazole             9          2
## 21       triazole            30          3
## 22       triazole            34          6
## 23       triazole            36          6
## 24       triazole            37          4
## 25       triazole            39          2
## 26       triazole            40          1
## 27       triazole            45         15
## 28       triazole            65          8
## 29       triazole            66         11

Disease strength of untreated check (i.e., disease pressure)

seedwt.data$category_pressure[seedwt.data$ReferenceNumb %in% index.low] <- "low"
seedwt.data$category_pressure[seedwt.data$ReferenceNumb %in% index.med] <- "medium"
seedwt.data$category_pressure[seedwt.data$ReferenceNumb %in% index.high] <- "high"
table(seedwt.data$category_pressure)
## 
##   high    low medium 
##     98     29     17

Year of study

table(seedwt.data$studyYear)
## 
## 2006 2007 2008 2013 
##   76   12   31   25
seedwt.data$category_year[seedwt.data$studyYear!="2007"] <- 
  seedwt.data$studyYear[seedwt.data$studyYear!="2007"]
summaryBy(FID~category_year+ReferenceNumb, 
          data=seedwt.data[! is.na(seedwt.data$category_year),],
          FUN=length)
##    category_year ReferenceNumb FID.length
## 1           2006            36         23
## 2           2006            37         15
## 3           2006            38          6
## 4           2006            39         11
## 5           2006            40          4
## 6           2006            45         17
## 7           2008            65         18
## 8           2008            66         13
## 9           2013            30          9
## 10          2013            32          4
## 11          2013            34         12
seedwt.data$category_year[seedwt.data$studyYear!="2006"] <- NA

6. Calculate effect sizes

Using log response ratio, cannot have 0s in data; so changing 0 to 0.0001

rust.data$m1i[rust.data$m1i==0] <- 0.0001
rust.data$m2i[rust.data$m2i==0] <- 0.0001

yield.data$m1i[yield.data$m1i==0] <- 0.0001
yield.data$m2i[yield.data$m2i==0] <- 0.0001

seedwt.data$m1i[seedwt.data$m1i==0] <- 0.0001
seedwt.data$m2i[seedwt.data$m2i==0] <- 0.0001

Log response ratio (“ROM”)

Even though here we impute 1s as the standard deviations for each record, we are using the log response ratio, and it does not use SD in its calculation.

rust.data.ROM <- escalc(measure = "ROM", m1i = m1i, m2i = m2i, 
                    sd1i = rep(1,nrow(rust.data)), 
                    sd2i = rep(1,nrow(rust.data)), 
                    n1i = n1i, n2i = n2i,
                    data = rust.data)
yield.data.ROM <- escalc(measure = "ROM", m1i = m1i, m2i = m2i, 
                     sd1i = rep(1,nrow(yield.data)), 
                     sd2i = rep(1,nrow(yield.data)), 
                     n1i = n1i, n2i = n2i,
                     data = yield.data)
seedwt.data.ROM <- escalc(measure = "ROM", m1i = m1i, m2i = m2i, 
                      sd1i = rep(1,nrow(seedwt.data)), 
                      sd2i = rep(1,nrow(seedwt.data)), 
                      n1i = n1i, n2i = n2i,
                      data = seedwt.data)

7. Save files for analysis

save(rust.data.ROM, yield.data.ROM, seedwt.data.ROM,
     file="data/output_data/data_cleaned.R")

Save files to csv for DRUM archival

rust.data.cleaned <- rust.data.ROM[,c(1:6,52:63)]
write.csv(x = rust.data.cleaned, file = "data/rust_data_cleaned.csv")
yield.data.cleaned <- yield.data.ROM[,c(1:6,54:66)]
write.csv(x = yield.data.cleaned, file = "data/yield_data_cleaned.csv")
seedwt.data.cleaned <- seedwt.data.ROM[,c(1:6,52:64)]
write.csv(x = seedwt.data.cleaned, file = "data/seedwt_data_cleaned.csv")

Footer

Spun with ezspin(“programs/data_processing.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)
##  mime          0.5     2016-07-07 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)