0

My aim is to make boxplot with stats between different groups using ggpubr. I use the following code to make the boxplot, but I am not sure how can I include stats for comapirsions between for ex, Control Major against Stress Major or Major against Minor under Control.

intensity<-read.table("light_intensity.txt",header = TRUE)
ggboxplot(intensity, x = "Treatment", y = "Intensity",
   color = "Allele", palette = "jco")

From this previous question, I know that adding

stat_compare_means(comparisons = my_comparisons)

could solve my problem. But how to design the my_comparison for my specific dataset?

My dataset look like,

Allele  Intensity   Treatment
Minor   6723.05258  Control
Minor   7022.128191 Control
Minor   6617.97381  Control
.
.
.
Major   5743.119742 STRESS
Major   5379.326667 STRESS
Major   7256.877569 STRESS
Major   5588.727273 STRESS
Lee
  • 25
  • 1
  • 8

1 Answers1

0

Add a new column to your dataset where Control Major as 1, Stress Major as 2.

Assign the values correspondingly to all your required groups and then create the comparisons of interest.

my_comp <- list( c("1", "2"), c("1", "3"), c("2", "3"), c("3", "1"))