1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
| ## Load all the libraries needed and the data
library(readr)
library(mosaic)
library(FSA)
library("ggplot2")
library(readxl)
library(knitr)
library(doBy)
library(agricolae)
options(scipen=999, digits = 0)
mydata <- read_excel("./data/2016-Solanum-01-11_Isolates(Germplasms).xlsx")
## getwd()
####Eggs PER PLANT ####
##Create a subset of the desire variable
Sub.Eggs <- subset(mydata,
select=c(Nger,
Isolate,
EggsP) )
####Isolate: MIAd####
Sub.Eggs.MIAd <- subset(Sub.Eggs, Isolate == "MIAd", select=c(Nger, EggsP))
Sub.Eggs.MIAd$Nger = factor (Sub.Eggs.MIAd$Nger, labels=c("EC", "TB", "TE", "TS", "TT"))
###Descriptive statistics calculation###
Sub.Eggs.MIAd.EC <- subset(Sub.Eggs.MIAd, Nger == "EC", select=c(Nger,EggsP))
Me.EP.MIAd.EC <- mean(Sub.Eggs.MIAd.EC$EggsP, na.mr=FALSE)
Me.EP.MIAd.EC <- round(Me.EP.MIAd.EC, digits=2)
Se.EP.MIAd.EC <- se(Sub.Eggs.MIAd.EC$EggsP)
Se.EP.MIAd.EC <- round(Se.EP.MIAd.EC, digits=2)
Sub.Eggs.MIAd.SB <- subset(Sub.Eggs.MIAd, Nger == "TB", select=c(Nger,EggsP))
Me.EP.MIAd.TB <- mean(Sub.Eggs.MIAd.SB$EggsP, na.mr=FALSE)
Me.EP.MIAd.TB <- round(Me.EP.MIAd.TB, digits=2)
Se.EP.MIAd.TB <- se(Sub.Eggs.MIAd.SB$EggsP)
Se.EP.MIAd.TB <- round(Se.EP.MIAd.TB, digits=2)
Sub.Eggs.MIAd.SB <- subset(Sub.Eggs.MIAd, Nger == "TE", select=c(Nger,EggsP))
Me.EP.MIAd.TE <- mean(Sub.Eggs.MIAd.SB$EggsP, na.mr=FALSE)
Me.EP.MIAd.TE <- round(Me.EP.MIAd.TE, digits=2)
Se.EP.MIAd.TE <- se(Sub.Eggs.MIAd.SB$EggsP)
Se.EP.MIAd.TE <- round(Se.EP.MIAd.TE, digits=2)
Sub.Eggs.MIAd.SB <- subset(Sub.Eggs.MIAd, Nger == "TS", select=c(Nger,EggsP))
Me.EP.MIAd.TS <- mean(Sub.Eggs.MIAd.SB$EggsP, na.mr=FALSE)
Me.EP.MIAd.TS <- round(Me.EP.MIAd.TS, digits=2)
Se.EP.MIAd.TS <- se(Sub.Eggs.MIAd.SB$EggsP)
Se.EP.MIAd.TS <- round(Se.EP.MIAd.TS, digits=2)
Sub.Eggs.MIAd.SB <- subset(Sub.Eggs.MIAd, Nger == "TT", select=c(Nger,EggsP))
Me.EP.MIAd.TT <- mean(Sub.Eggs.MIAd.SB$EggsP, na.mr=FALSE)
Me.EP.MIAd.TT <- round(Me.EP.MIAd.TT, digits=2)
Se.EP.MIAd.TT <- se(Sub.Eggs.MIAd.SB$EggsP)
Se.EP.MIAd.TT <- round(Se.EP.MIAd.TT, digits=2)
####Kruskall-Wallis test calculation####
KTMIAd = kruskal.test(Sub.Eggs.MIAd$EggsP ~ Sub.Eggs.MIAd$Nger)
####Dunn test calculation####
DTMIAd = dunnTest(Sub.Eggs.MIAd$EggsP ~ Sub.Eggs.MIAd$Nger, method="bonferroni")
DTMIAd.Comparison <- DTMIAd$res$Comparison
DTMIAd.Padj <- round (DTMIAd$res$P.adj, digits=5)
KrusData = data.frame(DTMIAd.Comparison, DTMIAd.Padj)
RND = nrow(DTMIAd$res)
krustable=kable(KrusData[1:RND,])
if (KTMIAd$p.value>0.05) {
dif="There is no significative differences (P<0.05) between treatments (P<0.05)"
krustable="0"
} else {
dif="There is significative differences between treatments (P<0.05)."
krustable=kable(KrusData[1:RND,])
boxplot(Sub.Eggs.MIAd$EggsP ~ Sub.Eggs.MIAd$Nger, main = "MIAd", xlab = "Germplasm", ylab = "Eggs per plant")
DTMIAd$dtres
}
|