library(readr)
GMCConstation <- read_csv("GMCConstation.csv")
## Parsed with column specification:
## cols(
## site = col_character(),
## season = col_double(),
## Plot = col_double(),
## treat = col_character(),
## subtreat = col_character(),
## rep = col_double(),
## biomass = col_double(),
## `biomass/1000` = col_double(),
## grain = col_double(),
## `grain/1000` = col_double()
## )
View(GMCConstation)
attach(GMCConstation)
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)
library(ggrepel)
library(tidyr)
##
## Attaching package: 'tidyr'
## The following object is masked from 'package:Matrix':
##
## expand
library(dplyr)
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:gridExtra':
##
## combine
## The following objects are masked from 'package:lubridate':
##
## intersect, setdiff, union
## The following objects are masked from 'package:Hmisc':
##
## src, summarize
## The following object is masked from 'package:MASS':
##
## select
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(dplyr) # for data manipulation
library(tidyr) # for data tidying
library(ggplot2) # for generating the visualizations
library(ggalluvial)
library(tidyverse)
## -- Attaching packages ------------------------------------------------ tidyverse 1.2.1 --
## v tibble 2.1.3 v stringr 1.4.0
## v purrr 0.3.2 v forcats 0.4.0
## -- Conflicts --------------------------------------------------- tidyverse_conflicts() --
## x psych::%+%() masks ggplot2::%+%()
## x scales::alpha() masks psych::alpha(), ggplot2::alpha()
## x lubridate::as.difftime() masks base::as.difftime()
## x scales::col_factor() masks readr::col_factor()
## x dplyr::combine() masks gridExtra::combine()
## x lubridate::date() masks base::date()
## x purrr::discard() masks scales::discard()
## x tidyr::expand() masks Matrix::expand()
## x dplyr::filter() masks stats::filter()
## x lubridate::intersect() masks base::intersect()
## x dplyr::lag() masks stats::lag()
## x dplyr::select() masks MASS::select()
## x lubridate::setdiff() masks base::setdiff()
## x dplyr::src() masks Hmisc::src()
## x dplyr::summarize() masks Hmisc::summarize()
## x lubridate::union() masks base::union()
rep=as.factor(rep)
season=as.numeric(season)
treat=as.factor(treat)
subtreat=as.factor(subtreat)
site=as.factor(site)
######################ANOVA###############
mod<-aov(grain~rep+season:rep+treat+subtreat+site+site:treat+season:site:rep+site:season+subtreat:treat:rep,data=GMCConstation)
anova(mod)
## Analysis of Variance Table
##
## Response: grain
## Df Sum Sq Mean Sq F value Pr(>F)
## rep 1 4621400 4621400 4.3387 0.038798 *
## treat 3 17687523 5895841 5.5352 0.001206 **
## subtreat 1 72293422 72293422 67.8707 5.124e-14 ***
## site 1 215539214 215539214 202.3532 < 2.2e-16 ***
## rep:season 1 5827559 5827559 5.4710 0.020532 *
## treat:site 3 5760664 1920221 1.8027 0.148685
## season:site 1 37617 37617 0.0353 0.851167
## rep:season:site 1 3438801 3438801 3.2284 0.074199 .
## rep:treat:subtreat 7 11416808 1630973 1.5312 0.159960
## Residuals 165 175751952 1065163
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## rep 1 4621400 4621400 4.339 0.03880 *
## treat 3 17687523 5895841 5.535 0.00121 **
## subtreat 1 72293422 72293422 67.871 5.12e-14 ***
## site 1 215539214 215539214 202.353 < 2e-16 ***
## rep:season 1 5827559 5827559 5.471 0.02053 *
## treat:site 3 5760664 1920221 1.803 0.14868
## season:site 1 37617 37617 0.035 0.85117
## rep:season:site 1 3438801 3438801 3.228 0.07420 .
## rep:treat:subtreat 7 11416808 1630973 1.531 0.15996
## Residuals 165 175751952 1065163
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 1 observation deleted due to missingness
##########################################FACETS grain############################
##################season#####################
ggplot(GMCConstation, aes(x = treat, y = grain)) + geom_point() + geom_smooth() + geom_line(stat = "smooth", method = "loess") + facet_grid(~season)+ theme_classic(base_size = 20)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

ggplot(GMCConstation, aes(x = treat, y = grain/1000)) + geom_smooth (method = "lm") + geom_point() + facet_grid(~season)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))+ scale_y_continuous(breaks = c(0,1.5,2.5,3.5,4.5,5.5,6.5,7.5))
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

##########subtreat###############
ggplot(GMCConstation, aes(x = treat, y = grain)) + geom_point() + geom_smooth() + geom_line(stat = "smooth", method = "loess") + facet_grid(~subtreat)+ theme_classic(base_size = 20)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

ggplot(GMCConstation, aes(x = treat, y = grain)) + geom_smooth (method = "lm") + geom_point() + facet_grid(~subtreat)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

#################site################
ggplot(GMCConstation, aes(x = treat, y = grain)) + geom_point() + geom_smooth() + geom_line(stat = "smooth", method = "loess") + facet_grid(~site)+ theme_classic(base_size = 20)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

ggplot(GMCConstation, aes(x = treat, y = grain)) + geom_smooth (method = "lm") + geom_point() + facet_grid(~site)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

##########################################FACETS biomass############################
##################season#####################
ggplot(GMCConstation, aes(x = treat, y = biomass)) + geom_point() + geom_smooth() + geom_line(stat = "smooth", method = "loess") + facet_grid(~season)+ theme_classic(base_size = 20)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

ggplot(GMCConstation, aes(x = treat, y = biomass)) + geom_smooth (method = "lm") + geom_point() + facet_grid(~season)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))

##########subtreat###############
ggplot(GMCConstation, aes(x = treat, y = biomass)) + geom_point() + geom_smooth() + geom_line(stat = "smooth", method = "loess") + facet_grid(~subtreat)+ theme_classic(base_size = 20)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

ggplot(GMCConstation, aes(x = treat, y = biomass)) + geom_smooth (method = "lm") + geom_point() + facet_grid(~subtreat)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))

#################site################
ggplot(GMCConstation, aes(x = treat, y = biomass)) + geom_point() + geom_smooth() + geom_line(stat = "smooth", method = "loess") + facet_grid(~site)+ theme_classic(base_size = 20)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

ggplot(GMCConstation, aes(x = treat, y = biomass/1000)) + geom_smooth (method = "lm") + geom_point() + facet_grid(~site)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))+ scale_y_continuous(breaks = c(0,1.5,2.5,3.5,4.5,5.5,6.5,7.5))

co<-data.frame(biomass, grain)
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: 'xts'
## The following objects are masked from 'package:dplyr':
##
## first, last
##
## 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)

ggplot(GMCConstation, aes(x = grain, fill = site)) +
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 1 rows containing non-finite values (stat_bin).

ggplot(GMCConstation, aes(x = biomass, fill = site)) +
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

#####################grain#################
pl = ggplot(GMCConstation, aes(x=treat, y=grain, color=site)) + geom_point(shape=16, alpha = 0.5) + geom_smooth(method=lm)
pl + facet_wrap(~season, ncol=3)+ theme_classic(base_size = 20)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

pl = ggplot(GMCConstation, aes(x=treat, y=grain, color=site)) + geom_point(shape=16, alpha = 0.5) + geom_smooth(method=lm)
pl + facet_wrap(~subtreat, ncol=3)+ theme_classic(base_size = 20)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

#############biomass################
pl = ggplot(GMCConstation, aes(x=treat, y=biomass, color=site)) + geom_point(shape=16, alpha = 0.5) + geom_smooth(method=lm)
pl + facet_wrap(~season, ncol=3)+ theme_classic(base_size = 20)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1))

pl = ggplot(GMCConstation, aes(x=treat, y=biomass, color=site)) + geom_point(shape=16, alpha = 0.5) + geom_smooth(method=lm)
pl + facet_wrap(~subtreat, ncol=3)+ theme_classic(base_size = 20)+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1))

#################density plots#################
ggplot(data = GMCConstation, mapping = aes(x = grain, fill = site)) + geom_density(alpha = 0.5)
## Warning: Removed 1 rows containing non-finite values (stat_density).

ggplot(data = GMCConstation, mapping = aes(x = biomass, fill = site)) + geom_density(alpha = 0.5)

#############Adding the trend line#####################
ggplot(GMCConstation, aes(biomass, grain)) +
geom_point() +
geom_smooth(mapping = aes(linetype = "r2"),
method = "lm",
formula = y ~ x + log(x), se = FALSE,
color = "red")+
facet_grid(. ~ treat)
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

ggplot(GMCConstation, aes(biomass/1000, grain/1000)) +
geom_point() + geom_smooth(mapping = aes(linetype = "r2"),
method = "lm",
formula = y ~ x + log(x), se = FALSE,
color = "blue")+
facet_grid(. ~ treat)+ scale_y_continuous(breaks = c(0,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7))
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

ggplot(GMCConstation, aes(biomass, grain)) +
geom_point() +
facet_grid(. ~ season)
## Warning: Removed 1 rows containing missing values (geom_point).

ggplot(GMCConstation, aes(biomass/1000, grain/1000)) +
geom_point() +
facet_grid(. ~ season)+ scale_y_continuous(breaks = c(0,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7))
## Warning: Removed 1 rows containing missing values (geom_point).

ggplot(GMCConstation, aes(biomass, grain)) +
geom_point() + geom_smooth(mapping = aes(linetype = "r2"),
method = "lm",
formula = y ~ x + log(x), se = FALSE,
color = "gold")+
facet_grid(. ~ site)
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

ggplot(GMCConstation, aes(biomass/1000, grain/1000)) +
geom_point() + geom_smooth(mapping = aes(linetype = "r2"),
method = "lm",
formula = y ~ x + log(x), se = FALSE,
color = "green")+
facet_grid(. ~ site)+ scale_y_continuous(breaks = c(0,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7))
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

####################VIOLIN PLOTS EMBEDDED WITH BOXPLOTS####################
###########grain##############
theme_set(theme_gray(base_size =15))
m <- ggplot(data=GMCConstation,aes(x=treat, y=grain))
m + geom_violin(size=1.3,shape=8) + geom_boxplot(width=.2, outlier.size=0,fill=c("red","yellow","grey", "blue"))+ylab("Grain yield [t/ha]") + xlab("treatment")+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))
## Warning: Ignoring unknown parameters: shape
## Warning: Removed 1 rows containing non-finite values (stat_ydensity).
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).

############grain/1000###########
theme_set(theme_gray(base_size =15))
m <- ggplot(data=GMCConstation,aes(x=treat, y=grain/1000))
m + geom_violin(size=1.3,shape=8) + geom_boxplot(width=.2, outlier.size=0,fill=c("red","yellow","grey", "blue"))+ylab("Grain yield [t/ha]") + xlab("treatment")+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))
## Warning: Ignoring unknown parameters: shape
## Warning: Removed 1 rows containing non-finite values (stat_ydensity).
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).

###########biomass##############
theme_set(theme_gray(base_size =15))
m <- ggplot(data=GMCConstation,aes(x=treat, y=biomass))
m + geom_violin(size=1.3,shape=8) + geom_boxplot(width=.2, outlier.size=0,fill=c("red","yellow","grey", "blue"))+ylab("biomass [t/ha]") + xlab("treatment")+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))
## Warning: Ignoring unknown parameters: shape

############biomass/1000###########
theme_set(theme_gray(base_size =15))
m <- ggplot(data=GMCConstation,aes(x=treat, y=biomass/1000))
m + geom_violin(size=1.3,shape=8) + geom_boxplot(width=.2, outlier.size=0,fill=c("red","yellow","grey", "blue"))+ylab("biomass [t/ha]") + xlab("treatment")+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))+ scale_y_continuous(breaks = c(0,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7))
## Warning: Ignoring unknown parameters: shape

###############boxplots##############
theme_set(theme_gray(base_size =12))
ggplot(GMCConstation, aes(x = treat, y =grain/1000, color = treat)) +
geom_boxplot(size=1.2,varwidth = TRUE) +
geom_point(data = GMCConstation, aes(y = mean(grain/1000))) +
geom_line(data = GMCConstation, aes(y =mean(grain/1000)))+ylab("Grain yield [t/ha] ") + xlab("treatment")+
theme( axis.text.x = element_text( angle = 90, hjust = 1))+ scale_y_continuous(breaks = c(0,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7))
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 186 rows containing missing values (geom_point).
## Warning: Removed 186 rows containing missing values (geom_path).

###############facets#################
theme_set(theme_gray(base_size =12))
ggplot(GMCConstation, aes(x = treat, y =grain/1000, color = treat)) +
geom_boxplot(size=1.2,varwidth = TRUE) +
geom_point(data = GMCConstation, aes(y = mean(grain/1000))) +
geom_line(data = GMCConstation, aes(y =mean(grain/1000)))+ylab("Grain yield [t/ha] ") + xlab("treatment") + facet_wrap(.~season)+
theme( axis.text.x = element_text( angle = 90, hjust = 1))+ scale_y_continuous(breaks = c(0,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7))
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 186 rows containing missing values (geom_point).
## Warning: Removed 186 rows containing missing values (geom_path).

####################facets##################
theme_set(theme_gray(base_size =14))
ggplot(GMCConstation, aes(x = treat, y =grain/1000, color = treat)) +
geom_boxplot(size=1.2,varwidth = TRUE) +
geom_point(data = GMCConstation, aes(y = mean(grain/1000))) +
geom_line(data = GMCConstation, aes(y =mean(grain/1000)))+ylab("Grain yield [t/ha] ") + xlab("treatment")+ facet_wrap(.~site)+
theme( axis.text.x = element_text( angle = 90, hjust = 1))+ scale_y_continuous(breaks = c(0,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7))
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 186 rows containing missing values (geom_point).
## Warning: Removed 186 rows containing missing values (geom_path).

theme_set(theme_gray(base_size =12))
ggplot(GMCConstation, aes(x = treat, y =grain/1000, fill=treat)) +
geom_boxplot(size=1.2,varwidth = TRUE) +
geom_point(data = GMCConstation, aes(y = mean(grain/1000))) +
geom_line(data = GMCConstation, aes(y =mean(grain)))+ylab("Grain yield [t/ha] ") + xlab("treatment")+ theme( axis.text.x = element_text( angle = 90, hjust = 1))+ scale_y_continuous(breaks = c(0,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7))
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 186 rows containing missing values (geom_point).
## Warning: Removed 186 rows containing missing values (geom_path).

###############Create a scatter plot with biomass/grain on the x axis and treat on the y axis.######
ggplot(GMCConstation, aes(x = treat, y = grain/1000)) +
geom_point(aes(color = season, size = subtreat))+ scale_y_continuous(breaks = c(0,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7))
## Warning: Using size for a discrete variable is not advised.
## Warning: Removed 1 rows containing missing values (geom_point).

ggplot(GMCConstation, aes(x = treat, y = grain/1000)) +
geom_point(aes(color = site, size = subtreat))+ scale_y_continuous(breaks = c(0,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7))
## Warning: Using size for a discrete variable is not advised.
## Warning: Removed 1 rows containing missing values (geom_point).

ggplot(GMCConstation, aes(x = treat, y = biomass/1000))+
geom_text(aes(label = site),color = "gray") +
geom_point(aes(color = site, size = season))+ scale_y_continuous(breaks = c(0,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7))

#Simple alluvial diagram
ggplot(GMCConstation, aes(kg = grain/1000, axis1 = subtreat, axis2 = season)) +
geom_stratum() + geom_alluvium(aes(fill = subtreat), color = "black")

#####################
ggplot(GMCConstation, aes(kg = grain/1000, axis1 = subtreat, axis2 = season)) +
geom_alluvium(aes(fill = subtreat), color = "black") + geom_stratum()

#Add text
ggplot(GMCConstation, aes(kg = grain/1000, axis1 = subtreat, axis2 = season)) +
geom_alluvium(aes(fill = subtreat), color = "black") + geom_stratum() +
geom_text(stat = "stratum", label.strata = TRUE) +
theme(legend.position = "true",
axis.text = element_text(size=14))

#Simple alluvial diagram
ggplot(GMCConstation, aes(kg = biomass/1000, axis1 = treat, axis2 = season)) +
geom_stratum() + geom_alluvium(aes(fill = subtreat), color = "black")

#####################
ggplot(GMCConstation, aes(kg = biomass/1000, axis1 = treat, axis2 = season)) +
geom_alluvium(aes(fill = treat), color = "black") + geom_stratum()

#Add text
ggplot(GMCConstation, aes(kg = biomass/1000, axis1 = treat, axis2 = season)) +
geom_alluvium(aes(fill = treat), color = "black") + geom_stratum() +
geom_text(stat = "stratum", label.strata = TRUE) +
theme(legend.position = "true",
axis.text = element_text(size=14))

###################GEOM PLOTS #########################
ggplot(data = GMCConstation, aes(x=season,y=grain/1000,color=subtreat))+
geom_point()+ geom_smooth()
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 2017
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 2.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 3.8785e-016
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 4.0401
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used
## at 2017
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 2.01
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal
## condition number 3.8785e-016
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other
## near singularities as well. 4.0401
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 2017
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 2.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 3.8722e-016
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 4.0401
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used
## at 2017
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 2.01
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal
## condition number 3.8722e-016
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other
## near singularities as well. 4.0401
## Warning: Removed 1 rows containing missing values (geom_point).
