---
title: "Chi_square_distribution"
author: "Lucie_Gourmet"
date: "11/04/2022"
output: html_document
---

```{r setup, include=FALSE}
library(tidyverse)
library(ggplot2)
library(ggpubr)
library(ggrepel)
rm(list=ls())
load("/Users/luciegourmet/Dropbox/Projects/DriverLandscape/SupportingTables/Final_list_escape_genes/annot_table_with_immune_category.RData")
annot_table<-annot_table_with_immune_category
```

```{r pandriver}
plot(pressure)
```

```{r IDH1}
setwd("/Users/luciegourmet/Dropbox/Projects/DriverLandscape/Final_figures/Chi_square")
plot_chi<-function(x="IDH1", i=c("Essential_Splice", "Missense", "Nonsense", "Stop_loss", "Synonymous")){


df_esc<-annot_table %>% filter(escapedall=="YES", gene==x, impact %in%i)%>% select(gene, TCGAid, aachange)
colnames(df_esc)<-c("Hugo_Symbol", "Sample_ID",	"Protein_Change")
#write.table(df_esc,"df_esc_IDH1.txt",sep="\t",row.names=FALSE)

df_nonesc<-annot_table %>% filter(escapedall=="NO", gene==x, impact%in%i)%>% select(gene, TCGAid, aachange)
colnames(df_nonesc)<-c("Hugo_Symbol", "Sample_ID",	"Protein_Change")
#write.table(df_nonesc,"df_nonesc_IDH1.txt",sep="\t",row.names=FALSE)

df_esc_x_mut<-length(df_esc$Protein_Change)
df_esc_x_sites<-length(unique(df_esc$Protein_Change))
esc_mut<-c(df_esc_x_mut, df_esc_x_sites)

df_non_esc_x_mut<-length(df_nonesc$Protein_Change)
df_non_esc_x_sites<-length(unique(df_nonesc$Protein_Change))
esc_wt<-c(df_non_esc_x_mut, df_non_esc_x_sites)

IDH1<-data.frame(esc_mut, esc_wt)


IDH1<-IDH1%>% rownames_to_column("Total")%>% pivot_longer(!Total, names_to = "Escape", values_to = "count")

IDH1_01<-IDH1%>% slice(rep(1, df_esc_x_mut))
IDH1_02<-IDH1%>% slice(rep(2, df_non_esc_x_mut))
IDH1_03<-IDH1%>% slice(rep(3, df_esc_x_sites))
IDH1_04<-IDH1%>% slice(rep(4, df_non_esc_x_sites))
IDH1_all<-bind_rows(IDH1_01, IDH1_02, IDH1_03, IDH1_04)
ggstatsplot::ggbarstats(
  data = IDH1_all,label = "both",
  x = Escape,
  y = Total,
  nboot = 100,
  #palette = "default_jama",
  #labels.legend = c("0 = V-shaped", "1 = straight"),
  legend.title = "Escape"
)

}

p<-plot_chi(x="KRAS")
ggsave("KRAS_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="KRAS")
ggsave("KRAS_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="HRAS")
ggsave("HRAS_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="NRAS")
ggsave("NRAS_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="BRAF")
ggsave("BRAF_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="TP53")
ggsave("TP53_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="IDH1")
ggsave("IDH1_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="CDKN2A")
ggsave("CDKN2A_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="SMAD4")
ggsave("SMAD4_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="SPOP")
ggsave("SPOP_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="EGFR")
ggsave("EGFR_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="GTF2I")
ggsave("GTF2I_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="GNA11")
ggsave("GNA11_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="VHL")
ggsave("VHL_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="SH3PXD2A")
ggsave("SH3PXD2A_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="SPANXD")
ggsave("SPANXD_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="NFE2L2")
ggsave("NFE2L2_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="RHOA")
ggsave("RHOA_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="CTNNB1")
ggsave("CTNNB1_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="REG1B")
ggsave("REG1B_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="FBXW7")
ggsave("FBXW7_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="FGFR2")
ggsave("FGFR2_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="ERBB2")
ggsave("ERBB2_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="TRIM51")
ggsave("TRIM51_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="PPP2R1A")
ggsave("PPP2R1A_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="KEAP1")
ggsave("KEAP1_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="TPTE")
ggsave("TPTE_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="CNTNAP5")
ggsave("CNTNAP5_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="ZNF679")
ggsave("ZNF679_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="ZNF98")
ggsave("ZNF98_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="PTEN")
ggsave("PTEN_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="PIK3CA")
ggsave("PIK3CA_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi(x="AC068775.1")
ggsave("AC068775.1_chi.pdf",plot = p, units = "cm",height = 20, width = 25)

# chi square for driver genes combined

x=c("HRAS","KRAS","NRAS","BRAF","TP53","IDH1","CDKN2A","SMAD4","SPOP","EGFR","GTF2I","GNA11","VHL","SH3PXD2A","SPANXD","NFE2L2","RHOA","CTNNB1","REG1B","FBXW7","FGFR2","ERBB2","TRIM51","PPP2R1A","KEAP1","TPTE","CNTNAP5","ZNF679","ZNF98","PTEN","AC068775.1","PIK3CA")
i=c("Essential_Splice", "Missense", "Nonsense", "Stop_loss")

df_esc<-annot_table %>% filter(escapedall=="YES", gene %in% x, impact %in%i)%>% select(gene, TCGAid, aachange)
colnames(df_esc)<-c("Hugo_Symbol", "Sample_ID",	"Protein_Change")
#write.table(df_esc,"df_esc_drivergenes.txt",sep="\t",row.names=FALSE)

df_nonesc<-annot_table %>% filter(escapedall=="NO", gene %in% x, impact%in%i)%>% select(gene, TCGAid, aachange)
colnames(df_nonesc)<-c("Hugo_Symbol", "Sample_ID",	"Protein_Change")
#write.table(df_nonesc,"df_nonesc_drivergenes.txt",sep="\t",row.names=FALSE)

df_esc_x_mut<-length(df_esc$Protein_Change)
df_esc_x_sites<-length(unique(df_esc$Protein_Change))
esc_mut<-c(df_esc_x_mut, df_esc_x_sites)

df_non_esc_x_mut<-length(df_nonesc$Protein_Change)
df_non_esc_x_sites<-length(unique(df_nonesc$Protein_Change))
esc_wt<-c(df_non_esc_x_mut, df_non_esc_x_sites)

drivergenes<-data.frame(esc_mut, esc_wt)


drivergenes<-drivergenes%>% rownames_to_column("Total")%>% pivot_longer(!Total, names_to = "Escape", values_to = "count")

drivergenes_01<-drivergenes%>% slice(rep(1, df_esc_x_mut))
drivergenes_02<-drivergenes%>% slice(rep(2, df_non_esc_x_mut))
drivergenes_03<-drivergenes%>% slice(rep(3, df_esc_x_sites))
drivergenes_04<-drivergenes%>% slice(rep(4, df_non_esc_x_sites))
drivergenes_all<-bind_rows(drivergenes_01, drivergenes_02, drivergenes_03, drivergenes_04)
p<-ggstatsplot::ggbarstats(
  data = drivergenes_all,label = "both",
  x = Escape,
  y = Total,
  nboot = 100,
  #palette = "default_jama",
  #labels.legend = c("0 = V-shaped", "1 = straight"),
  legend.title = "Escape"
)
ggsave("pandriver_chi.pdf",plot = p, units = "cm",height = 20, width = 25)


plot_chi(x="KRAS", i="Synonymous")
plot_chi(x="IDH1")
plot_chi(x="IDH1", i="Synonymous")

plot_chi(x="BRAF")
plot_chi(x="BRAF", i="Synonymous")
plot_chi(x="EGFR")
plot_chi(x="EGFR", i="Synonymous")
plot_chi(x="EGFR", i="Missense")


####synonymous



```

## Including Plots

You can also embed plots, for example:

```{r heatmap}
library(pheatmap)
#heatmap p values
#add loading excel, clean code, put in R markdown for manuscript
library(tidyverse)
p<- P_value_lolliplots %>% column_to_rownames("Gene") 
p<-p %>% arrange(p_value)
p<-pheatmap(p, cluster_rows = FALSE, cluster_cols = FALSE)
ggsave("Heatmap_pancancer_sig_genes_chi_square.pdf",plot = p, units = "cm",height = 20, width = 20)

```




```{r heatmap with sampling}
library(statsExpressions)
plot_chi_patient<-function(x="IDH1", i=c("Essential_Splice", "Missense", "Nonsense", "Stop_loss")){

###Sample patients#####  
list_escaped<-annot_table %>% filter(escapedall=="YES") %>% dplyr::select(TCGAid) %>% unique()
list_nonescaped<-annot_table %>% filter(escapedall=="NO") %>% dplyr::select(TCGAid) %>% unique() 
ids<-sample(x = list_nonescaped$TCGAid,size = length(list_escaped$TCGAid))
finalids<-c(ids, list_escaped$TCGAid)
annot_table_filt<-annot_table %>% filter(TCGAid %in% finalids)
####END SAMPLE PATIENTS####

df_esc<-annot_table_filt %>% filter(escapedall=="YES", gene %in% x, impact %in%i)%>% select(gene, TCGAid, aachange)
colnames(df_esc)<-c("Hugo_Symbol", "Sample_ID",	"Protein_Change")
#write.table(df_esc,"df_esc_IDH1.txt",sep="\t",row.names=FALSE)

df_nonesc<-annot_table_filt %>% filter(escapedall=="NO", gene %in% x, impact%in%i)%>% select(gene, TCGAid, aachange)
colnames(df_nonesc)<-c("Hugo_Symbol", "Sample_ID",	"Protein_Change")
#write.table(df_nonesc,"df_nonesc_IDH1.txt",sep="\t",row.names=FALSE)

df_esc_x_pat<-length(unique(df_esc$Sample_ID))
df_esc_x_sites<-length(unique(df_esc$Protein_Change))
esc_mut<-c(df_esc_x_pat, df_esc_x_sites)

df_non_esc_x_pat<-length(unique(df_nonesc$Sample_ID))
df_non_esc_x_sites<-length(unique(df_nonesc$Protein_Change))
esc_wt<-c(df_non_esc_x_pat, df_non_esc_x_sites)

IDH1<-data.frame(esc_mut, esc_wt)


IDH1<-IDH1%>% rownames_to_column("Total")%>% pivot_longer(!Total, names_to = "Escape", values_to = "count")

IDH1_01<-IDH1%>% slice(rep(1, df_esc_x_pat))
IDH1_02<-IDH1%>% slice(rep(2, df_non_esc_x_pat))
IDH1_03<-IDH1%>% slice(rep(3, df_esc_x_sites))
IDH1_04<-IDH1%>% slice(rep(4, df_non_esc_x_sites))
IDH1_all<-bind_rows(IDH1_01, IDH1_02, IDH1_03, IDH1_04)
plot_test1<-ggstatsplot::ggbarstats(
  data = IDH1_all,label = "both",
  x = Escape,
  y = Total,
  output = "subtitle",
  nboot = 100,type = "nonparametric", 
  #palette = "default_jama",
  #labels.legend = c("0 = V-shaped", "1 = straight"),
  legend.title = "Escape"
)
return(plot_test1)
}

#plot with sampling
p<-plot_chi_patient(x="KRAS")


p<-plot_chi_patient(x="HRAS")


p<-plot_chi_patient(x="NRAS")


p<-plot_chi_patient(x="BRAF")

p<-plot_chi_patient(x="TP53")


p<-plot_chi_patient(x="IDH1")



p<-plot_chi_patient(x="PIK3CA")


p<-plot_chi_patient(x="EGFR")



p<-plot_chi_patient(x="GNA11")

p<-plot_chi_patient(x="GNAQ")

p<-plot_chi_patient(x="GTF2I")


p<-plot_chi_patient(x="AKT1")



p<-plot_chi_patient(x="PPP2R1A")








library(pheatmap)
#heatmap p values
#add loading excel, clean code, put in R markdown for manuscript
library(tidyverse)
p<- P_value_with_sampling %>% column_to_rownames("Gene") 
p<-p %>% arrange(p_value)
p<-pheatmap(p, cluster_rows = FALSE, cluster_cols = FALSE)
ggsave("Heatmap_chi_square_with_sampling.pdf",plot = p, units = "cm",height = 20, width = 20)








plot_chi_patient_no_sampling<-function(x="IDH1", i=c("Essential_Splice", "Missense", "Nonsense", "Stop_loss")){



df_esc<-annot_table %>% filter(escapedall=="YES", gene %in% x, impact %in%i)%>% select(gene, TCGAid, aachange)
colnames(df_esc)<-c("Hugo_Symbol", "Sample_ID",	"Protein_Change")
#write.table(df_esc,"df_esc_IDH1.txt",sep="\t",row.names=FALSE)

df_nonesc<-annot_table%>% filter(escapedall=="NO", gene %in% x, impact%in%i)%>% select(gene, TCGAid, aachange)
colnames(df_nonesc)<-c("Hugo_Symbol", "Sample_ID",	"Protein_Change")
#write.table(df_nonesc,"df_nonesc_IDH1.txt",sep="\t",row.names=FALSE)

df_esc_x_pat<-length(unique(df_esc$Sample_ID))
df_esc_x_sites<-length(unique(df_esc$Protein_Change))
esc_mut<-c(df_esc_x_pat, df_esc_x_sites)

df_non_esc_x_pat<-length(unique(df_nonesc$Sample_ID))
df_non_esc_x_sites<-length(unique(df_nonesc$Protein_Change))
esc_wt<-c(df_non_esc_x_pat, df_non_esc_x_sites)

IDH1<-data.frame(esc_mut, esc_wt)


IDH1<-IDH1%>% rownames_to_column("Total")%>% pivot_longer(!Total, names_to = "Escape", values_to = "count")

IDH1_01<-IDH1%>% slice(rep(1, df_esc_x_pat))
IDH1_02<-IDH1%>% slice(rep(2, df_non_esc_x_pat))
IDH1_03<-IDH1%>% slice(rep(3, df_esc_x_sites))
IDH1_04<-IDH1%>% slice(rep(4, df_non_esc_x_sites))
IDH1_all<-bind_rows(IDH1_01, IDH1_02, IDH1_03, IDH1_04)
plot_test1<-ggstatsplot::ggbarstats(
  data = IDH1_all,label = "both",
  x = Escape,
  y = Total,
  output = "subtitle",
  nboot = 100,type = "nonparametric", 
  #palette = "default_jama",
  #labels.legend = c("0 = V-shaped", "1 = straight"),
  legend.title = "Escape"
)
return(plot_test1)
}
#patient

genelist_drivers<-c("TP53", "PIK3CA", "KRAS", "PTEN", "CDKN2A","FBXW7", "BRAF","NFE2L2","CTNNB1", "IDH1","SMAD4", "NRAS", "KEAP1")
lapply(genelist_drivers, plot_chi_patient)

genelist_drivers<-c("CASP8" , "ZNF98", "CPZ" , "ZNF679", "DEFB119", "TRAT1", "KLHL4","CYLC2" , "CFAP58", "SLITRK6",  "TRIM9", "KRTAP19-5", "SPRR2A", "GPR141", "LONRF2", "C19orf47","SLC12A3")

genelist_drivers<-c("ERBB3", "FGFR2", "RAC1", "ERBB2",  "AC068775.1", "SETD2","FGFR3",
             "RHOA" ,"STXBP5L", "PPP2R1A","SPTA1", "VHL", "NOTCH1","HIST1H3B",
             "HRAS","CDH1", "KCNQ5", "PDYN", "BAP1",  "CDH10" , "REG3G" ,
             "C8B", "CHD4" , "ATM" , "POLR2B", "ERBB4",  "WDR17",  "CUL1",    
             "POT1", "SMARCA4", "TRIM51", "DNAH9", "AKT1", "BRCA2","CRX",      
             "SPANXD", "LUM", "EIF1AX", "BIRC8", "PTCHD4", "HNF4A", "LINGO1",    
             "EGFR", "SPOP", "CDC73", "GNAQ", "PCDH7", "LAMA3", "CNTNAP5",   
             "HTR1F", "PCDH10", "CDH7", "GTF2I", "REG1B", "GNA11")  

lapply(genelist_drivers, plot_chi_patient_no_sampling)
test_1<-plot_chi_patient(x="IDH1")

library(pheatmap)
#heatmap p values
#add loading excel, clean code, put in R markdown for manuscript
library(tidyverse)
setwd("/Users/luciegourmet/Dropbox/Projects/DriverLandscape/Manuscript/Scripts_order")
#all
P_value_chi_square<-P_value_without_sampling_chi_square[1:2]
p<- P_value_chi_square %>% column_to_rownames("Gene") 
p<-p %>% arrange(P_value)

 mybreaks <- seq(0,0.1,by=0.005)
 #mybreaks
# Plot the heatmap

p_chi_square <-pheatmap(p, cluster_rows = FALSE, cluster_cols = FALSE, breaks=mybreaks)
ggsave("Heatmap_chi_square_drivers.pdf",plot = p_chi_square, units = "cm",height = 30, width = 20)



p<-plot_chi_patient(x="IDH1")
ggsave("IDH1_chi1.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("IDH1_chi2.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("IDH1_chi3.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("IDH1_chi4.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("IDH1_chi5.pdf",plot = p, units = "cm",height = 20, width = 25)

p<-plot_chi_patient(x="BRAF")
ggsave("BRAF_chi1.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("BRAF_chi2.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("BRAF_chi3.pdf",plot = p, units = "cm",height = 20, width = 25)


average_IDH1<-(1.25e-04+3.40e-04+4.34e-05+1.02e-04+ 7.47e-05)/5
#0.00013702

p<-plot_chi_patient(x="KRAS")
ggsave("KRAS_chi1.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("KRAS_chi2.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("KRAS_chi3.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("KRAS_chi4.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("KRAS_chi5.pdf",plot = p, units = "cm",height = 20, width = 25)

average_KRAS<-(0.98+0.90+0.53+ 0.48+0.88)/5
#0.754
  
plot_chi_patient(x="HRAS")
plot_chi_patient(x="NRAS")

plot_chi_patient(x=c("KRAS", "HRAS", "NRAS"))

#mut

p<-plot_chi(x="IDH1")
ggsave("IDH1_chi1_mut.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("IDH1_chi2_mut.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("IDH1_chi3_mut.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("IDH1_chi4_mut.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("IDH1_chi5_mut.pdf",plot = p, units = "cm",height = 20, width = 25)


average_IDH1<-(1.25e-04+3.40e-04+4.34e-05+1.02e-04+ 7.47e-05)/5
#0.00013702

p<-plot_chi(x="KRAS")
ggsave("KRAS_chi1_mut.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("KRAS_chi2_mut.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("KRAS_chi3_mut.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("KRAS_chi4_mut.pdf",plot = p, units = "cm",height = 20, width = 25)
ggsave("KRAS_chi5_mut.pdf",plot = p, units = "cm",height = 20, width = 25)




average_KRAS<-( 0.01+)/5
```

```{r heatmap}

#heatmap for 85 genes
plot_chi<-function(x="IDH1", i=c("Essential_Splice", "Missense", "Nonsense", "Stop_loss", "Synonymous")){


df_esc<-annot_table %>% filter(escapedall=="YES", gene==x, impact %in%i)%>% select(gene, TCGAid, aachange)
colnames(df_esc)<-c("Hugo_Symbol", "Sample_ID",	"Protein_Change")
#write.table(df_esc,"df_esc_IDH1.txt",sep="\t",row.names=FALSE)

df_nonesc<-annot_table %>% filter(escapedall=="NO", gene==x, impact%in%i)%>% select(gene, TCGAid, aachange)
colnames(df_nonesc)<-c("Hugo_Symbol", "Sample_ID",	"Protein_Change")
#write.table(df_nonesc,"df_nonesc_IDH1.txt",sep="\t",row.names=FALSE)

df_esc_x_mut<-length(df_esc$Protein_Change)
df_esc_x_sites<-length(unique(df_esc$Protein_Change))
esc_mut<-c(df_esc_x_mut, df_esc_x_sites)

df_non_esc_x_mut<-length(df_nonesc$Protein_Change)
df_non_esc_x_sites<-length(unique(df_nonesc$Protein_Change))
esc_wt<-c(df_non_esc_x_mut, df_non_esc_x_sites)

IDH1<-data.frame(esc_mut, esc_wt)


IDH1<-IDH1%>% rownames_to_column("Total")%>% pivot_longer(!Total, names_to = "Escape", values_to = "count")

IDH1_01<-IDH1%>% slice(rep(1, df_esc_x_mut))
IDH1_02<-IDH1%>% slice(rep(2, df_non_esc_x_mut))
IDH1_03<-IDH1%>% slice(rep(3, df_esc_x_sites))
IDH1_04<-IDH1%>% slice(rep(4, df_non_esc_x_sites))
IDH1_all<-bind_rows(IDH1_01, IDH1_02, IDH1_03, IDH1_04)
ggstatsplot::ggbarstats(
  data = IDH1_all,label = "both",
  x = Escape,
  y = Total,
  nboot = 100,
  #palette = "default_jama",
  #labels.legend = c("0 = V-shaped", "1 = straight"),
  legend.title = "Escape"
)

}

  
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
