#create data frame from table
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
plant <- c("AKN195", "AKN195", "AKN195", "AKN195", "AKN195", "AKN195", "AKN195", "AKN195", "AKN195", "AKN195",
"AKN1", "AKN1", "AKN1", "AKN1", "AKN1", "AKN1", "AKN1", "AKN1", "AKN1", "AKN1",
"TR83102", "TR83102", "TR83102", "TR83102", "TR83102", "TR83102", "TR83102", "TR83102", "TR83102", "TR83102",
"TR83113", "TR83113", "TR83113", "TR83113", "TR83113", "TR83113", "TR83113", "TR83113", "TR83113", "TR83113")
foc_treatment <- c("control", "control", "control", "control", "control", "treated", "treated", "treated", "treated", "treated",
"control", "control", "control", "control", "control", "treated", "treated", "treated", "treated", "treated",
"control", "control", "control", "control", "control", "treated", "treated", "treated", "treated", "treated",
"control", "control", "control", "control", "control", "treated", "treated", "treated", "treated", "treated")
dai <- c(0.00, 0.00, 0.00, 0.00, 0.00, 54.17, 81.25, 56.25, 81.25, 75.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 75.00, 75.00, 75.00, 75.00, 75.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00)
audpc <- c(0.00, 0.00, 0.00, 0.00, 0.00, 43.45, 68.75, 43.75, 61.61, 57.14, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 35.71, 35.71, 37.50, 33.93, 39.29, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00)
phenotype <- c("*", "*", "*", "*", "*", "S", "S", "S", "S", "S",
"R", "R", "R", "R", "R", "R", "R", "R", "R", "R",
"*", "*", "*", "*", "*", "S", "S", "S", "S", "S",
"R", "R", "R", "R", "R", "R", "R", "R", "R", "R")
df <- data.frame(Plant = plant, Foc_Treatment = foc_treatment, DAI = dai, AUDPC = audpc, Phenotype = phenotype)
df_a <- df %>% filter(Foc_Treatment %in% c("treated"))
#DAI: Day after inoculation; AUDPC: Area under disease progress curve; R: Resistant plant; S: susceptible plant; *: No disease symptoms were observed in control plants.
df_aa <- df_a %>% filter(Plant %in% c("AKN195"))
varyans <- var(df_aa$AUDPC)
standart_sapma <- sd(df_aa$AUDPC)
n <- length(df_aa$AUDPC)
standart_hata <- standart_sapma / sqrt(n)
df_ab <- df_a %>% filter(Plant %in% c("TR83102"))
varyans_TR <- var(df_ab$AUDPC)
standart_sapma_TR <- sd(df_ab$AUDPC)
n <- length(df_ab$AUDPC)
standart_hata_TR <- standart_sapma_TR / sqrt(n)
library(ggplot2)
summary_data <- data.frame(
Plant = c("AKN195", "TR83102"),
Variance = c(varyans, varyans_TR),
Standart_Sapma = c(standart_sapma, standart_sapma_TR),
Standart_Hata = c(standart_hata, standart_hata_TR)
)
# Bar plot oluÅŸtur
ggplot(summary_data, aes(x = Plant, y = Variance, fill = Plant)) +
geom_bar(stat = "identity") +
geom_errorbar(aes(ymin = Variance - standart_sapma, ymax = Variance + standart_sapma), width = 0.2) +
labs(title = "Variation of AUDPC by Plant", x = "Plant", y = "Variance") +
theme_minimal()