###impoting the data set

library(readr)
heatold_across <- read_csv("~/yield/Gonhi/heatold_across.csv")
## Parsed with column specification:
## cols(
##   .default = col_double(),
##   name = col_character(),
##   Season = col_character(),
##   NameOfExperiment = col_character(),
##   NameOfLocation = col_character(),
##   Management = col_character(),
##   MegaEnv = col_character(),
##   PlantingDate = col_character(),
##   HarvestDate = col_character()
## )
## See spec(...) for full column specifications.
View(heatold_across)
attach(heatold_across)
names(heatold_across)
##  [1] "rep"              "blk"              "plot"            
##  [4] "entry"            "name"             "range"           
##  [7] "longrow"          "gyd"              "ad"              
## [10] "asi"              "ph"               "eh"              
## [13] "epo"              "rl"               "sl"              
## [16] "epp"              "hc"               "er"              
## [19] "gls"              "ps"               "et"              
## [22] "sen"              "tex"              "moisture"        
## [25] "np"               "msv"              "ea"              
## [28] "sd"               "Site"             "Year"            
## [31] "Season"           "NameOfExperiment" "NameOfLocation"  
## [34] "Management"       "MegaEnv"          "PlantingDate"    
## [37] "HarvestDate"      "PlotSize"
### defining factor variables
rep=as.factor(rep)
blk=as.factor(blk)
plot=as.factor(plot)
name=as.factor(name)
Site=as.factor(Site)
Season=as.factor(Season)
Year=as.factor(Year)
NameOfExperiment=as.factor(NameOfExperiment)
NameOfLocation=as.factor(NameOfLocation)
Management=as.factor(Management)
MegaEnv=as.factor(MegaEnv)
PlantingDate=as.factor(PlantingDate)
HarvestDate=as.factor(HarvestDate)
##loading the required packages 
library(lme4)
## Loading required package: Matrix
library(lmerTest)
## 
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
## 
##     lmer
## The following object is masked from 'package:stats':
## 
##     step
library(ggplot2)
library(psych)
## 
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
library(agricolae)
require(MASS)
## Loading required package: MASS
library(Hmisc)
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
## 
## Attaching package: 'Hmisc'
## The following object is masked from 'package:psych':
## 
##     describe
## The following objects are masked from 'package:base':
## 
##     format.pval, units
library(lubridate) # for working with dates
## 
## Attaching package: 'lubridate'
## The following object is masked from 'package:base':
## 
##     date
library(scales)   # to access breaks/formatting functions
## 
## Attaching package: 'scales'
## The following objects are masked from 'package:psych':
## 
##     alpha, rescale
## The following object is masked from 'package:readr':
## 
##     col_factor
library(gridExtra) # for arranging plots
library(ggthemes)
fulmodel<-aov(gyd~rep+name+Season+Management+Year+NameOfLocation+PlantingDate+PlotSize,data = heatold_across)
anova(fulmodel)
## Analysis of Variance Table
## 
## Response: gyd
##                 Df  Sum Sq Mean Sq  F value    Pr(>F)    
## rep              1    5.53    5.53   1.9578    0.1622    
## name            63 1040.90   16.52   5.8506 < 2.2e-16 ***
## Season           1 1081.59 1081.59 382.9987 < 2.2e-16 ***
## Management       3  136.60   45.53  16.1241 3.844e-10 ***
## NameOfLocation   1    1.75    1.75   0.6214    0.4308    
## Residuals      694 1959.86    2.82                       
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
x<- LSD.test(fulmodel,"Season",alpha=0.05,group=FALSE)
diffograph(x,cex.axis=0.8,xlab="Maize Grain Yield ",ylab="")

# Example 2
x<- REGW.test(fulmodel,"Management",alpha=0.05,group=FALSE)
diffograph(x,cex.axis=0.6,xlab="Maize Grain Yield ",ylab="",color1="brown",color2="green")

x<- REGW.test(fulmodel,"name",alpha=0.05,group=FALSE)
diffograph(x,cex.axis=0.6,xlab="Maize Grain Yield ",ylab="",color1="brown",color2="green")

out <- LSD.test(fulmodel,"Season", p.adj="bonferroni")
out
## $statistics
##    MSerror  Df     Mean       CV
##   2.823999 694 5.486987 30.62657
## 
## $parameters
##         test  p.ajusted name.t ntr alpha
##   Fisher-LSD bonferroni Season   2  0.05
## 
## $means
##           gyd      std   r      LCL      UCL       Min       Max      Q25
## Main 6.324470 2.282425 510 6.178369 6.470571 0.9089076 13.910000 4.702682
## Off  3.805426 1.403955 254 3.598402 4.012451 0.4705345  7.913985 2.851965
##           Q50      Q75
## Main 6.428612 7.923872
## Off  3.813722 4.848364
## 
## $comparison
## NULL
## 
## $groups
##           gyd groups
## Main 6.324470      a
## Off  3.805426      b
## 
## attr(,"class")
## [1] "group"
out <- LSD.test(fulmodel,"Management", p.adj="bonferroni")
out
## $statistics
##    MSerror  Df     Mean       CV
##   2.823999 694 5.486987 30.62657
## 
## $parameters
##         test  p.ajusted     name.t ntr alpha
##   Fisher-LSD bonferroni Management   5  0.05
## 
## $means
##                      gyd      std   r      LCL      UCL       Min
## Heat Stress     4.078080 1.045519 128 3.786449 4.369711 1.1925656
## High Density    6.584642 2.117897 128 6.293011 6.876273 1.2929793
## Managed Drought 3.528445 1.650888 126 3.234508 3.822381 0.4705345
## Optimal         5.864493 2.259722 254 5.657469 6.071518 0.9089076
## Random Stress   6.977063 2.302239 128 6.685432 7.268694 0.9524706
##                       Max      Q25      Q50      Q75
## Heat Stress      6.130329 3.476197 4.131143 4.878723
## High Density    11.281210 4.997522 6.485728 7.846257
## Managed Drought  7.913985 2.234138 3.241170 4.748235
## Optimal         13.910000 4.284692 6.047552 7.292979
## Random Stress   13.750212 5.554985 7.308800 8.532401
## 
## $comparison
## NULL
## 
## $groups
##                      gyd groups
## Random Stress   6.977063      a
## High Density    6.584642      a
## Optimal         5.864493      b
## Heat Stress     4.078080      c
## Managed Drought 3.528445      c
## 
## attr(,"class")
## [1] "group"
out <- LSD.test(fulmodel,"name", p.adj="bonferroni")
out
## $statistics
##    MSerror  Df     Mean       CV
##   2.823999 694 5.486987 30.62657
## 
## $parameters
##         test  p.ajusted name.t ntr alpha
##   Fisher-LSD bonferroni   name  64  0.05
## 
## $means
##                gyd      std  r      LCL      UCL       Min       Max
## DJH172862 5.390364 1.820219 12 4.437901 6.342826 2.8161076  8.567754
## DJH173017 7.678004 2.221145 12 6.725542 8.630467 4.2974906 11.852621
## DJH173019 4.231284 1.358427 12 3.278822 5.183746 2.0995585  6.930106
## DJH173020 6.401354 1.836355 12 5.448892 7.353816 3.1588500  8.484751
## DJH173022 6.624105 2.731780 12 5.671643 7.576568 3.4470364 10.967485
## DJH173042 6.402506 2.128312 11 5.407691 7.397320 3.4863328 10.403137
## DJH173043 6.387206 2.251893 12 5.434744 7.339669 1.6935368  9.441882
## DJH173045 3.869159 1.613397 12 2.916696 4.821621 1.5990857  6.616094
## DJH173047 5.056920 2.095147 12 4.104457 6.009382 1.8693020  8.455171
## DJH173089 7.242751 2.767110 12 6.290289 8.195213 1.8006050 10.825717
## DJH173090 5.515160 2.585614 12 4.562698 6.467622 1.8505573  9.686409
## DJH173091 6.569642 1.850347 12 5.617180 7.522105 3.4843429  9.736605
## DJH173092 6.410721 2.484915 12 5.458258 7.363183 1.6621750  9.486198
## DJH173093 6.517966 2.877672 12 5.565504 7.470428 2.4151341 12.528941
## DJH173095 4.252962 1.518596 12 3.300500 5.205424 1.1292827  6.218434
## DJH173112 4.395264 1.679576 12 3.442802 5.347726 1.2929793  7.635541
## DJH173113 5.159846 2.032094 12 4.207384 6.112308 1.7250958  8.777537
## DJH173114 5.013503 1.760201 12 4.061041 5.965965 2.6328847  8.836948
## DJH173117 5.653008 2.065111 12 4.700546 6.605470 2.2268773  8.812424
## DJH173177 7.029101 1.649962 12 6.076639 7.981564 4.9064229 10.352941
## DJH173180 6.854061 2.666001 12 5.901599 7.806523 3.6957867 10.553725
## DJH173182 5.753900 2.808335 12 4.801438 6.706362 1.1918844 11.166620
## DJH173183 5.304140 2.017663 12 4.351678 6.256602 2.1333333  8.705506
## DJH173194 6.861851 2.429418 12 5.909388 7.814313 2.4764486 10.252047
## DJH173196 6.501813 2.800982 12 5.549351 7.454275 1.5372549 11.007534
## DJH173207 5.945693 1.782045 12 4.993230 6.898155 2.7231731  7.942454
## DJH173208 4.066945 2.226344 12 3.114482 5.019407 0.4705345  8.095624
## DJH173211 4.216262 1.904978 12 3.263800 5.168725 1.6000000  7.356737
## DJH173244 6.940411 2.434575 12 5.987949 7.892873 3.1080121 11.198745
## DJH173245 4.174259 1.966902 12 3.221796 5.126721 0.9098039  6.783570
## DJH173246 5.303528 2.332254 12 4.351066 6.255990 2.5339160 10.172415
## DJH173247 5.600664 2.450887 12 4.648202 6.553126 2.3540168  8.941786
## DJH173251 4.259496 1.669491 12 3.307034 5.211958 1.6000000  6.896941
## DJH173275 5.611611 1.910960 12 4.659149 6.564074 2.8562071  8.824650
## DJH173279 5.522932 1.740117 12 4.570470 6.475394 2.6455485  7.790933
## DJH173282 5.124061 2.442511 12 4.171598 6.076523 1.1925656  8.497694
## DJH173283 4.910561 2.024605 11 3.915747 5.905375 2.1007597  7.821983
## DJH173302 4.972236 1.201180 12 4.019774 5.924698 3.0131415  6.862521
## DJH173303 2.959740 1.337566 12 2.007278 3.912202 1.4738357  6.267339
## DJH173304 3.485185 1.842854 11 2.490371 4.479999 1.3180988  7.454835
## DJH173305 6.323321 1.853198 12 5.370859 7.275783 3.4839449  9.171254
## DJH173319 6.706489 2.227665 12 5.754026 7.658951 1.7878266  9.933338
## DJH173320 3.898012 3.302679 12 2.945550 4.850475 0.9089076 12.980000
## DJH173321 4.803879 1.853096 12 3.851416 5.756341 2.0904874  8.325378
## DJH173337 6.395701 2.129206 12 5.443239 7.348163 2.6039216 10.502525
## DJH173357 6.847690 1.764654 12 5.895228 7.800153 4.4945210 10.264596
## DJH173358 4.291578 1.093595 12 3.339115 5.244040 3.0445284  7.073703
## DJH173359 5.795155 1.902863 12 4.842693 6.747618 2.7107317  9.118476
## DJH173361 3.576437 1.834544 12 2.623975 4.528899 0.9185882  5.996280
## DJH173362 5.532885 1.715256 12 4.580422 6.485347 2.9776672  8.201681
## DJH173381 3.605516 1.647692 12 2.653054 4.557978 0.6901961  6.287059
## DJH173403 5.899370 1.829814 12 4.946907 6.851832 3.7440179 10.042729
## DJH173404 4.045012 1.882998 12 3.092550 4.997474 1.6311861  6.735812
## DJH173405 4.884696 2.326415 12 3.932233 5.837158 1.5367278  9.419796
## DJH173406 6.025514 1.430939 12 5.073052 6.977976 4.3098353  8.427133
## DJH173408 4.711018 2.199445 12 3.758556 5.663480 1.1532190  7.565266
## DJH173409 4.635246 2.561579 12 3.682783 5.587708 1.8509804  9.223422
## DJH173429 4.993902 2.099183 12 4.041440 5.946364 1.6311861  8.776964
## DJH173430 4.886647 1.722553 12 3.934185 5.839109 1.9450980  7.957943
## DJH173434 5.832544 2.039508 12 4.880082 6.785006 3.2328497  9.546756
## DJH173435 4.880445 2.467022 12 3.927983 5.832907 1.4553994  9.292800
## SC608     7.515151 1.892850 12 6.562688 8.467613 3.8752376  9.993681
## SC633     5.992747 2.553412 11 4.997932 6.987561 2.9576605 10.202891
## SC727     8.821606 3.529254 12 7.869143 9.774068 4.4595989 13.910000
##                Q25      Q50       Q75
## DJH172862 4.105068 5.414185  6.450698
## DJH173017 5.412954 8.298272  8.904471
## DJH173019 3.486354 4.234932  4.874711
## DJH173020 4.951519 6.761483  8.008865
## DJH173022 4.275179 6.475420  8.464134
## DJH173042 4.842545 5.831350  7.982073
## DJH173043 5.081035 6.590543  8.089896
## DJH173045 2.384161 4.316397  4.691759
## DJH173047 4.006010 4.699032  6.446037
## DJH173089 5.676047 6.759978  9.576067
## DJH173090 3.199833 6.295126  7.172571
## DJH173091 5.111436 6.465111  7.463718
## DJH173092 4.993452 6.418035  8.530384
## DJH173093 4.694255 6.531066  7.887597
## DJH173095 3.374468 4.588657  5.434487
## DJH173112 3.542694 4.535115  5.342118
## DJH173113 3.661963 5.582001  6.262194
## DJH173114 3.710826 4.748190  5.403429
## DJH173117 4.645983 5.752901  6.639812
## DJH173177 5.799239 6.848574  7.801224
## DJH173180 4.016806 7.851814  8.775368
## DJH173182 3.463574 6.544547  7.354676
## DJH173183 4.098477 5.112028  6.770913
## DJH173194 5.450041 7.589289  8.482080
## DJH173196 4.550518 6.014440  8.575624
## DJH173207 5.001632 6.533055  7.090124
## DJH173208 2.438812 4.098485  5.189513
## DJH173211 2.605867 3.997221  5.454378
## DJH173244 5.569452 6.282961  8.925652
## DJH173245 2.790707 3.928517  6.064816
## DJH173246 3.726710 4.916527  6.596240
## DJH173247 3.379318 6.146241  7.346286
## DJH173251 3.144515 4.785411  5.228491
## DJH173275 4.179743 5.715003  7.114434
## DJH173279 4.172415 6.096959  6.688699
## DJH173282 3.310021 4.906613  7.308477
## DJH173283 3.334841 5.063278  6.428038
## DJH173302 4.005107 5.155030  6.078360
## DJH173303 2.163096 2.657846  3.286064
## DJH173304 2.141472 3.364213  4.396918
## DJH173305 5.109777 6.261495  7.754900
## DJH173319 5.676577 6.429526  8.568973
## DJH173320 2.154698 2.556655  4.587249
## DJH173321 3.757578 4.318709  5.642586
## DJH173337 5.458628 6.200811  7.523433
## DJH173357 5.539469 6.601752  8.012343
## DJH173358 3.562997 4.238862  4.708301
## DJH173359 4.457295 6.266159  6.866841
## DJH173361 2.089170 3.575610  5.031196
## DJH173362 4.301635 5.363996  6.615126
## DJH173381 2.944511 3.656648  4.479755
## DJH173403 4.692170 5.683906  6.447883
## DJH173404 2.852804 3.476609  5.448641
## DJH173405 3.243948 4.692437  5.814633
## DJH173406 5.041448 5.509109  6.959910
## DJH173408 3.381842 4.374348  6.807261
## DJH173409 2.573628 3.674740  7.024000
## DJH173429 3.932648 5.117132  5.978756
## DJH173430 3.538518 4.679203  5.908491
## DJH173434 4.471108 5.055742  7.472941
## DJH173435 2.980966 4.583960  7.106151
## SC608     6.285868 8.121026  8.868464
## SC633     3.534087 6.783641  7.771608
## SC727     5.509472 9.250044 11.513546
## 
## $comparison
## NULL
## 
## $groups
##                gyd    groups
## SC727     8.821606         a
## DJH173017 7.678004        ab
## SC608     7.515151       abc
## DJH173089 7.242751      abcd
## DJH173177 7.029101     abcde
## DJH173244 6.940411    abcdef
## DJH173194 6.861851    abcdef
## DJH173180 6.854061    abcdef
## DJH173357 6.847690    abcdef
## DJH173319 6.706489   abcdefg
## DJH173022 6.624105   abcdefg
## DJH173091 6.569642   abcdefg
## DJH173093 6.517966   abcdefg
## DJH173196 6.501813  abcdefgh
## DJH173092 6.410721 abcdefghi
## DJH173042 6.402506 abcdefghi
## DJH173020 6.401354 abcdefghi
## DJH173337 6.395701 abcdefghi
## DJH173043 6.387206 abcdefghi
## DJH173305 6.323321 abcdefghi
## DJH173406 6.025514 abcdefghi
## SC633     5.992747 abcdefghi
## DJH173207 5.945693 abcdefghi
## DJH173403 5.899370  bcdefghi
## DJH173434 5.832544 bcdefghij
## DJH173359 5.795155 bcdefghij
## DJH173182 5.753900 bcdefghij
## DJH173117 5.653008 bcdefghij
## DJH173275 5.611611 bcdefghij
## DJH173247 5.600664 bcdefghij
## DJH173362 5.532885 bcdefghij
## DJH173279 5.522932 bcdefghij
## DJH173090 5.515160 bcdefghij
## DJH172862 5.390364 bcdefghij
## DJH173183 5.304140 bcdefghij
## DJH173246 5.303528 bcdefghij
## DJH173113 5.159846 bcdefghij
## DJH173282 5.124061 bcdefghij
## DJH173047 5.056920 bcdefghij
## DJH173114 5.013503 bcdefghij
## DJH173429 4.993902 bcdefghij
## DJH173302 4.972236 bcdefghij
## DJH173283 4.910561 bcdefghij
## DJH173430 4.886647 bcdefghij
## DJH173405 4.884696 bcdefghij
## DJH173435 4.880445 bcdefghij
## DJH173321 4.803879 bcdefghij
## DJH173408 4.711018  cdefghij
## DJH173409 4.635246  cdefghij
## DJH173112 4.395264   defghij
## DJH173358 4.291578    efghij
## DJH173251 4.259496    efghij
## DJH173095 4.252962    efghij
## DJH173019 4.231284    efghij
## DJH173211 4.216262    efghij
## DJH173245 4.174259    efghij
## DJH173208 4.066945     fghij
## DJH173404 4.045012     fghij
## DJH173320 3.898012      ghij
## DJH173045 3.869159      ghij
## DJH173381 3.605516       hij
## DJH173361 3.576437        ij
## DJH173304 3.485185        ij
## DJH173303 2.959740         j
## 
## attr(,"class")
## [1] "group"
mod<-lm(gyd~ph+eh+sen+epp+asi+ad,data = heatold_across)
anova(mod)
## Analysis of Variance Table
## 
## Response: gyd
##            Df  Sum Sq Mean Sq F value    Pr(>F)    
## ph          1  32.976  32.976 14.0638 0.0002744 ***
## eh          1   0.770   0.770  0.3283 0.5677546    
## sen         1  14.253  14.253  6.0786 0.0151094 *  
## epp         1  11.373  11.373  4.8506 0.0295645 *  
## asi         1   1.219   1.219  0.5197 0.4723820    
## ad          1   1.061   1.061  0.4525 0.5024609    
## Residuals 119 279.027   2.345                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(mod)
## 
## Call:
## lm(formula = gyd ~ ph + eh + sen + epp + asi + ad, data = heatold_across)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.0217 -1.0583 -0.2379  0.9995  4.3360 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)   
## (Intercept) -4.316602   3.546781  -1.217  0.22599   
## ph           0.014770   0.010932   1.351  0.17925   
## eh           0.001872   0.012964   0.144  0.88544   
## sen          3.706852   1.390782   2.665  0.00876 **
## epp          0.904164   0.406113   2.226  0.02787 * 
## asi          0.086568   0.102342   0.846  0.39932   
## ad           0.024467   0.036373   0.673  0.50246   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.531 on 119 degrees of freedom
##   (642 observations deleted due to missingness)
## Multiple R-squared:  0.181,  Adjusted R-squared:  0.1397 
## F-statistic: 4.382 on 6 and 119 DF,  p-value: 0.0004908
co<-data.frame(gyd,ph,eh,sen,epp,asi,ad) 
library(PerformanceAnalytics)
## Loading required package: xts
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## Registered S3 method overwritten by 'xts':
##   method     from
##   as.zoo.xts zoo
## 
## Attaching package: 'PerformanceAnalytics'
## The following objects are masked from 'package:agricolae':
## 
##     kurtosis, skewness
## The following object is masked from 'package:graphics':
## 
##     legend
chart.Correlation(co)

library(psych)
pairs.panels(co)

theme_set(theme_gray(base_size =12))
ggplot(heatold_across, aes(x = Management, y =gyd)) + 
    geom_boxplot(size=1.2,varwidth = TRUE) + 
    geom_point(data = heatold_across, aes(y = mean(gyd))) +
    geom_line(data = heatold_across, aes(y =mean(gyd)))+ylab("Maize Grain yield [t/ha] ") + xlab("Management")+theme(legend.position = c(0.2, 0.85))
## Warning: Removed 4 rows containing non-finite values (stat_boxplot).
## Warning: Removed 768 rows containing missing values (geom_point).
## Warning: Removed 768 rows containing missing values (geom_path).

#####################################################################


## facet wrappiong by se
theme_set(theme_gray(base_size =8))
ggplot(heatold_across, aes(x = Management, y =gyd)) + 
    geom_boxplot(size=1.2,varwidth = TRUE) + 
    geom_point(data = heatold_across, aes(y = mean(gyd))) +
    geom_line(data = heatold_across, aes(y =mean(gyd)))+ylab("Maize Grain yield [t/ha]") + xlab("Management")+theme(legend.position = c(0.2,0.85))+facet_wrap(.~Season)
## Warning: Removed 4 rows containing non-finite values (stat_boxplot).
## Warning: Removed 768 rows containing missing values (geom_point).
## Warning: Removed 768 rows containing missing values (geom_path).

## violin plots of Country maize grain yields 
theme_set(theme_gray(base_size =10))
m <- ggplot(data=heatold_across,aes(x=Management, y=gyd))
m + geom_violin(size=1.3,shape=8) + geom_boxplot(width=.2, outlier.size=0,fill=c("red","yellow","grey","green","black"))+ylab("Maize Grain yield [t/ha]") + xlab("Management")
## Warning: Ignoring unknown parameters: shape
## Warning: Removed 4 rows containing non-finite values (stat_ydensity).
## Warning: Removed 4 rows containing non-finite values (stat_boxplot).

##### location

theme_set(theme_gray(base_size =10))
m <- ggplot(data=heatold_across,aes(x=NameOfLocation, y=gyd))
m + geom_violin(size=1.3,shape=8) + geom_boxplot(width=.2, outlier.size=0,fill=c("red","yellow","grey","green","black"))+ylab("Maize Grain yield [t/ha]") + xlab("Location")
## Warning: Ignoring unknown parameters: shape
## Warning: Removed 4 rows containing non-finite values (stat_ydensity).
## Warning: Removed 4 rows containing non-finite values (stat_boxplot).

####################

theme_set(theme_gray(base_size =8))
m <- ggplot(data=heatold_across,aes(x=NameOfLocation, y=gyd))
m + geom_violin(size=1.3,shape=8) + geom_boxplot(width=.2, outlier.size=0,fill=c("red","yellow","grey","green","black"))+ylab("Maize Grain yield [t/ha]") + xlab("Location")+facet_wrap(.~Season)
## Warning: Ignoring unknown parameters: shape
## Warning: Removed 4 rows containing non-finite values (stat_ydensity).
## Warning: Removed 4 rows containing non-finite values (stat_boxplot).

ggplot(heatold_across, aes(x = ad , y = gyd, color = Management)) +  
  geom_point(size=3,  aes(shape=Management)) + 
  geom_smooth(method=lm, position = "jitter", aes(fill=Management), level = 0.95)+ylab("Maize Grain yield [t/ha]") + xlab("AD")
## Warning: Removed 7 rows containing non-finite values (stat_smooth).
## Warning: Removed 7 rows containing missing values (geom_point).

################################################################

ggplot(heatold_across, aes(x = ad , y = gyd, color = Season)) +  
  geom_point(size=3,  aes(shape=Season)) + 
  geom_smooth(method=lm, position = "jitter", aes(fill=Season), level = 0.95)+ylab("Maize Grain yield [t/ha]") + xlab("AD")
## Warning: Removed 7 rows containing non-finite values (stat_smooth).

## Warning: Removed 7 rows containing missing values (geom_point).

##### site

ggplot(heatold_across, aes(x = ad , y = gyd, color = Site)) +  
  geom_point(size=3) + 
  geom_smooth(method=lm, position = "jitter", aes(fill=Site), level = 0.95)+ylab("Maize Grain yield [t/ha]") + xlab("AD")
## Warning: Removed 7 rows containing non-finite values (stat_smooth).

## Warning: Removed 7 rows containing missing values (geom_point).

###### moisture
ggplot(heatold_across, aes(x = moisture , y = gyd, color = Management)) +  
  geom_point(size=3,  aes(shape=Management)) + 
  geom_smooth(method=lm, position = "jitter", aes(fill=Management), level = 0.95)+ylab("Maize Grain yield [t/ha]") + xlab("Moisture")
## Warning: Removed 4 rows containing non-finite values (stat_smooth).
## Warning: Removed 4 rows containing missing values (geom_point).

###### 
theme_set(theme_gray(base_size =10))
ggplot(heatold_across, aes(x = HarvestDate , y = gyd, color = Management)) +  
  geom_boxplot(size=1) + ylab("Maize Grain yield [t/ha]") + xlab("Harvest Date")+theme(legend.position = c(0.25,0.75))
## Warning: Removed 4 rows containing non-finite values (stat_boxplot).

#######
theme_set(theme_gray(base_size =10))
ggplot(heatold_across, aes(x = HarvestDate , y = gyd, color = NameOfLocation)) +  
  geom_boxplot(size=1) + ylab("Maize Grain yield [t/ha]") + xlab("Harvest Date")+theme(legend.position = c(0.25,0.75))
## Warning: Removed 4 rows containing non-finite values (stat_boxplot).

####

theme_set(theme_gray(base_size =10))
ggplot(heatold_across, aes(x = HarvestDate , y = gyd, color = Management)) +  
  geom_boxplot(size=1) + ylab("Maize Grain yield [t/ha]") + xlab("Harvest Date")+theme(legend.position = c(0.85,0.75))+facet_wrap(.~Season)
## Warning: Removed 4 rows containing non-finite values (stat_boxplot).

#######

theme_set(theme_gray(base_size =10))
ggplot(heatold_across, aes(x = PlantingDate , y = gyd, color = Management)) +  
  geom_boxplot(size=1) + ylab("Maize Grain yield [t/ha]") + xlab("Planting Date")+theme(legend.position = c(0.25,0.75))
## Warning: Removed 4 rows containing non-finite values (stat_boxplot).

theme_set(theme_gray(base_size =10))
ggplot(heatold_across, aes(x = PlantingDate , y = gyd, color = Management)) +  
  geom_boxplot(size=1) + ylab("Maize Grain yield [t/ha]") + xlab("Planting Date")+theme(legend.position = c(0.85,0.75))+facet_wrap(.~Season)
## Warning: Removed 4 rows containing non-finite values (stat_boxplot).