library(readxl)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.2 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.3 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(collapsibleTree)
DATA_BIOMASA <- read_excel("DATA BIOMASA.xlsx",
sheet = "Data R")
#view(DATA_BIOMASA)
### Tipo de variable
str(DATA_BIOMASA)
## tibble [130 × 4] (S3: tbl_df/tbl/data.frame)
## $ Fungicida : chr [1:130] "Propineb" "Propineb" "Propineb" "Propineb" ...
## $ Dosis : num [1:130] 100 100 100 100 100 10 10 10 10 10 ...
## $ Repeticion: num [1:130] 1 2 3 4 5 1 2 3 4 5 ...
## $ peso_seco : num [1:130] 70 70 70 70 40 100 100 70 100 100 ...
### Descripción visual
hist(DATA_BIOMASA$peso_seco)

## Prueba de normalidad
shapiro.test(DATA_BIOMASA$peso_seco)
##
## Shapiro-Wilk normality test
##
## data: DATA_BIOMASA$peso_seco
## W = 0.98463, p-value = 0.1508
controldef<-mean(DATA_BIOMASA$peso_seco[DATA_BIOMASA$Fungicida=="Control"])
#Cálculo de porcentaje de inhibición de biomasa
DATA_BIOMASA$porcentaje=(controldef-DATA_BIOMASA$peso_seco)/controldef*100
shapiro.test(DATA_BIOMASA$porcentaje)
##
## Shapiro-Wilk normality test
##
## data: DATA_BIOMASA$porcentaje
## W = 0.98463, p-value = 0.1508
hist(DATA_BIOMASA$porcentaje)

#Filtramos base de datos y agregar el ppm
DATA_BIOMASA$Dosis=paste(DATA_BIOMASA$Dosis, "ppm")
data_biomasa=DATA_BIOMASA %>% filter(Dosis==c("100 ppm","10 ppm","1 ppm","0.1 ppm"))
## Warning: There was 1 warning in `filter()`.
## ℹ In argument: `Dosis == c("100 ppm", "10 ppm", "1 ppm", "0.1 ppm")`.
## Caused by warning in `Dosis == c("100 ppm", "10 ppm", "1 ppm", "0.1 ppm")`:
## ! longer object length is not a multiple of shorter object length
### Gráfico de caja y bigotes
ggplot(data_biomasa,aes(y=porcentaje,x=as.factor(Fungicida),fill=as.factor(Fungicida)))+
geom_boxplot()+
facet_wrap(~Dosis)+
scale_color_brewer (palette= 'Set2')+
labs(title = "Porcentaje de inhibición de P.palmivora por fungicida",y="Inhibición (%)",x="Fungicida",caption = "Elaborado por: Andrea Galindo")+ theme_bw()+ theme(axis.text.x = element_text(angle = 45,vjust=0.2, hjust = 0.2, size=7))+ guides(fill=guide_legend(title = "Fungicida")+ theme(plot.title=element_text(hjust=0.5, size=12, face='bold', color='black'),axis.title=element_text(size=10,face="bold")))

##boxplot dosis
ggplot(data_biomasa,aes(y=porcentaje,x=as.factor(Dosis),fill=as.factor(Dosis)))+
geom_boxplot()+
labs(title = "Porcentaje de inhibición a P.palmivora según dosis",y="Inhibición (%)",x="Dosis",caption = "Elaborado por: Andrea Galindo")+
theme_bw()+
theme(axis.text.x = element_text(angle = 0,vjust=-0.7, hjust = 1, size=10))+
guides(fill = guide_legend(title = "Dosis"))

##boxplot Fungicida
ggplot(data_biomasa,aes(y=porcentaje,x=as.factor(Fungicida),fill=as.factor(Fungicida)))+
geom_boxplot()+
labs(title = "Efecto de diferentes fungicidas sobre la producción de biomasa \nde P. palmivora a nivel in-vitro",y="Inhibición (%)",x="Fungicida",caption = "Elaborado por: Andrea Galindo")+
theme_bw()+
theme(axis.text.x = element_text(angle = 45,vjust=0.9, hjust = 1, size=7))+
guides(fill = guide_legend(title = "Fungicida"))

#Filtramos base de datos
#data_biomasa=DATA_BIOMASA %>% filter(Dosis==c(100,10,1,0.1))
#Modelo
mod_1=aov(porcentaje~Fungicida+Fungicida*Dosis,data=data_biomasa)
summary(mod_1)
## Df Sum Sq Mean Sq F value Pr(>F)
## Fungicida 4 8881 2220 5.299 0.022005 *
## Dosis 3 23477 7826 18.677 0.000569 ***
## Fungicida:Dosis 12 9959 830 1.981 0.169136
## Residuals 8 3352 419
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#comparacion medias
library(agricolae)
prueba_comp=HSD.test(y = mod_1,trt =c("Fungicida","Dosis"),console = T)
##
## Study: mod_1 ~ c("Fungicida", "Dosis")
##
## HSD Test for porcentaje
##
## Mean Square Error: 419
##
## Fungicida:Dosis, means
##
## porcentaje std r se Min
## Cyazofamide:0.1 ppm 5.00000 7.071068 2 14.47411 0.00000
## Cyazofamide:1 ppm 20.00000 14.142136 2 14.47411 10.00000
## Cyazofamide:10 ppm 40.00000 14.142136 2 14.47411 30.00000
## Cyazofamide:100 ppm 79.00000 1.414214 2 14.47411 78.00000
## Dimethomorp + Fluazinam:0.1 ppm -15.96577 NA 1 20.46949 -15.96577
## Dimethomorp + Fluazinam:1 ppm 23.64303 NA 1 20.46949 23.64303
## Dimethomorp + Fluazinam:10 ppm 48.50856 NA 1 20.46949 48.50856
## Dimethomorp + Fluazinam:100 ppm 25.62347 NA 1 20.46949 25.62347
## Mancozeb + Cymoxanil:0.1 ppm -29.60000 NA 1 20.46949 -29.60000
## Mancozeb + Cymoxanil:1 ppm -72.10000 NA 1 20.46949 -72.10000
## Mancozeb + Cymoxanil:10 ppm 49.30000 NA 1 20.46949 49.30000
## Mancozeb + Cymoxanil:100 ppm 68.80000 NA 1 20.46949 68.80000
## Propamocarb:0.1 ppm 36.44760 NA 1 20.46949 36.44760
## Propamocarb:1 ppm 15.35663 NA 1 20.46949 15.35663
## Propamocarb:10 ppm 6.74499 NA 1 20.46949 6.74499
## Propamocarb:100 ppm 84.67279 NA 1 20.46949 84.67279
## Propineb:0.1 ppm -25.00000 49.497475 2 14.47411 -60.00000
## Propineb:1 ppm -40.00000 0.000000 2 14.47411 -40.00000
## Propineb:10 ppm 0.00000 0.000000 2 14.47411 0.00000
## Propineb:100 ppm 45.00000 21.213203 2 14.47411 30.00000
## Max Q25 Q50 Q75
## Cyazofamide:0.1 ppm 10.00000 2.50000 5.00000 7.50000
## Cyazofamide:1 ppm 30.00000 15.00000 20.00000 25.00000
## Cyazofamide:10 ppm 50.00000 35.00000 40.00000 45.00000
## Cyazofamide:100 ppm 80.00000 78.50000 79.00000 79.50000
## Dimethomorp + Fluazinam:0.1 ppm -15.96577 -15.96577 -15.96577 -15.96577
## Dimethomorp + Fluazinam:1 ppm 23.64303 23.64303 23.64303 23.64303
## Dimethomorp + Fluazinam:10 ppm 48.50856 48.50856 48.50856 48.50856
## Dimethomorp + Fluazinam:100 ppm 25.62347 25.62347 25.62347 25.62347
## Mancozeb + Cymoxanil:0.1 ppm -29.60000 -29.60000 -29.60000 -29.60000
## Mancozeb + Cymoxanil:1 ppm -72.10000 -72.10000 -72.10000 -72.10000
## Mancozeb + Cymoxanil:10 ppm 49.30000 49.30000 49.30000 49.30000
## Mancozeb + Cymoxanil:100 ppm 68.80000 68.80000 68.80000 68.80000
## Propamocarb:0.1 ppm 36.44760 36.44760 36.44760 36.44760
## Propamocarb:1 ppm 15.35663 15.35663 15.35663 15.35663
## Propamocarb:10 ppm 6.74499 6.74499 6.74499 6.74499
## Propamocarb:100 ppm 84.67279 84.67279 84.67279 84.67279
## Propineb:0.1 ppm 10.00000 -42.50000 -25.00000 -7.50000
## Propineb:1 ppm -40.00000 -40.00000 -40.00000 -40.00000
## Propineb:10 ppm 0.00000 0.00000 0.00000 0.00000
## Propineb:100 ppm 60.00000 37.50000 45.00000 52.50000
##
## Alpha: 0.05 ; DF Error: 8
## Critical Value of Studentized Range: 6.869381
##
## Groups according to probability of means differences and alpha level( 0.05 )
##
## Treatments with the same letter are not significantly different.
##
## porcentaje groups
## Propamocarb:100 ppm 84.67279 a
## Cyazofamide:100 ppm 79.00000 a
## Mancozeb + Cymoxanil:100 ppm 68.80000 ab
## Mancozeb + Cymoxanil:10 ppm 49.30000 abc
## Dimethomorp + Fluazinam:10 ppm 48.50856 abc
## Propineb:100 ppm 45.00000 abc
## Cyazofamide:10 ppm 40.00000 abc
## Propamocarb:0.1 ppm 36.44760 abc
## Dimethomorp + Fluazinam:100 ppm 25.62347 abc
## Dimethomorp + Fluazinam:1 ppm 23.64303 abc
## Cyazofamide:1 ppm 20.00000 abc
## Propamocarb:1 ppm 15.35663 abc
## Propamocarb:10 ppm 6.74499 abc
## Cyazofamide:0.1 ppm 5.00000 abc
## Propineb:10 ppm 0.00000 abc
## Dimethomorp + Fluazinam:0.1 ppm -15.96577 abc
## Propineb:0.1 ppm -25.00000 abc
## Mancozeb + Cymoxanil:0.1 ppm -29.60000 abc
## Propineb:1 ppm -40.00000 bc
## Mancozeb + Cymoxanil:1 ppm -72.10000 c
letras=prueba_comp$groups
length(letras)
## [1] 2
dosis_res=data_biomasa %>%
group_by(Fungicida,Dosis)%>%
summarise(por=mean(porcentaje),
err=sd(porcentaje)) %>%
arrange(desc(por))
## `summarise()` has grouped output by 'Fungicida'. You can override using the
## `.groups` argument.
dosis_res$letras=letras
dosis_res %>%
ggplot(aes(y=por,x=Fungicida,fill=as.factor(Dosis)))+
geom_bar(stat="identity")+
geom_errorbar(aes(ymin=por,ymax=por+err),width=0.1)+
#geom_text(aes(x=Fungicida,y=por+err,label=letras),size=3)+
labs(title = "Efecto de diferentes fungicidas sobre la producción de biomasa \nde P. palmivora a nivel in-vitro",y="Inhibición (%)",x="Fungicida",caption = "Elaborado por: Andrea Galindo")+
facet_wrap(~Dosis)+
scale_color_brewer (palette= 'Set2')+
theme_bw() + guides(fill = guide_legend(title = "Fungicida"))+ theme(plot.title=element_text(hjust=0.5, size=12, face='bold', color='black'),axis.title=element_text(size=10,face="bold"),axis.text.x = element_text(angle = 45,vjust=0.2, hjust = 0.2, size=7))+
scale_fill_hue(labels = c("Antracol", "Javari","Rainbow","Ranman","Sideral"))
