text: user4595: I have a data frame for two groups and 9 variables 
  > head(aa)
    treatment variable     value
  1       pre     Sig1 0.1173863
  2       pre     Sig1 0.1888243
  3       pre     Sig1 0.2191765
  4       pre     Sig1 0.1277735
  5       pre     Sig1 0.1711712
  6       pre     Sig1 0.0000000
  > class(aa)
  [1] "data.frame"
  > str(aa)
  'data.frame':   1026 obs. of  3 variables:
   $ treatment: Factor w/ 2 levels "post","pre": 2 2 2 2 2 2 2 2 2 2 ...
   $ variable : Factor w/ 9 levels "Sig1","Sig2",..: 1 1 1 1 1 1 1 1 1 1 ...
   $ value    : num  0.117 0.189 0.219 0.128 0.171 ...
  > tail(aa)
       treatment variable value
  1021      post     Sig9     0
  1022      post     Sig9     0
  1023      post     Sig9     0
  1024      post     Sig9     0
  1025      post     Sig9     0
  1026      post     Sig9     0
  >
  
  I am using this code
  library(ggpubr)
  > p <- ggboxplot(aa, x = "variable", y = "value",color = "treatment")
  > my_comparisons <- c("pre","post")
  > p + stat_compare_means(comparisons = my_comparisons)+ stat_compare_means(label.y = 50)  
  Warning message:
  Computation failed in `stat_signif()`:
  missing value where TRUE/FALSE needed 
  > 
  
  But I am getting this weird plot
  
  While something like this is my goal
  
  I really don't know where I am doing wrong
  I used ggplot where I got something like this but I need statistics that is why I have stuck on this 
  
  I then used this code 
  > DF <- aa %>% pivot_longer(.,cols = c(Sig1,Sig2,Sig3, Sig4,Sig5,Sig6,Sig7,Sig8,Sig9), names_to = "var", values_to = "val")
  > View(DF)
  > library(ggplot2)
  > library(ggpubr)
  > ggplot(DF, aes(x = treatment, y = val, fill = treatment))+
  +     geom_boxplot()+
  +     stat_compare_means(comparisons = c("pre","post")+
  +     stat_compare_means()+
  +     facet_grid(var~., scales = "free")
  + 
  
  But I got another weird plot
  
  But changing the scale I got this but gives one statistics
  
  While I need one stat for each variable between pre and post groups
  This solution gives to statistics
  > p <- ggboxplot(aa, x = "variable", y = "value",color = "treatment",facet.by = "variable")
  > p + stat_compare_means(comparisons = my_comparisons)+ stat_compare_means(label.y =2)
  
  
  When I edited my code
  > p <- ggboxplot(aa, x = "variable", y = "value",color = "treatment")
  > p + stat_compare_means(aes(group = variable))
  > 
  
  But again one stat
  
  
  user3541: The problem is the scale used: For the plot you called "weird" (first from the top), the scale is 50 and for the "ggplot only" (third from the top) the scale is 1.
  You should play with the stat_compare_means(label.y = 50) bit, you can try setting the label.y parameter to 1.5 or 2.
  EDIT BECAUSE OF THE ADDITIONAL REMARKS ON THE QUESTION:
  Once again (and for sure the last time), I had to manually create example data as OP ignores repeated reminders on how to make a reproducible example with R.
  library(data.table)
  library(ggpubr)
  
  text <- "
  treatment variable     value
  1       pre     Sig1 0.1173863
  2       pre     Sig1 0.1888243
  3       pre     Sig1 0.2191765
  4       pre     Sig1 0.1277735
  5       pre     Sig1 0.1711712
  6       pre     Sig1 0.0000000
  1       post     Sig1 0.1173863
  2       post     Sig1 0.1888243
  3       post     Sig1 0.2191765
  4       post     Sig1 0.1277735
  5       post     Sig1 0.1711712
  6       post     Sig1 0.0000000
  1021      pre     Sig9     0
  1022      pre     Sig9     0
  1023      pre     Sig9     0
  1024      pre     Sig9     0
  1025      pre     Sig9     0
  1026      pre     Sig9     0
  1021      post     Sig9     1
  1022      post     Sig9     1
  1023      post     Sig9     1
  1024      post     Sig9     1
  1025      post     Sig9     1
  1026      post     Sig9     1
  "
  my_data <-fread(text)
  
  > my_data
        V1 treatment variable     value
   1:    1       pre     Sig1 0.1173863
   2:    2       pre     Sig1 0.1888243
   3:    3       pre     Sig1 0.2191765
   4:    4       pre     Sig1 0.1277735
   5:    5       pre     Sig1 0.1711712
   6:    6       pre     Sig1 0.0000000
   7:    1      post     Sig1 0.1173863
   8:    2      post     Sig1 0.1888243
   9:    3      post     Sig1 0.2191765
  10:    4      post     Sig1 0.1277735
  11:    5      post     Sig1 0.1711712
  12:    6      post     Sig1 0.0000000
  13: 1021       pre     Sig9 0.0000000
  14: 1022       pre     Sig9 0.0000000
  15: 1023       pre     Sig9 0.0000000
  16: 1024       pre     Sig9 0.0000000
  17: 1025       pre     Sig9 0.0000000
  18: 1026       pre     Sig9 0.0000000
  19: 1021      post     Sig9 1.0000000
  20: 1022      post     Sig9 1.0000000
  21: 1023      post     Sig9 1.0000000
  22: 1024      post     Sig9 1.0000000
  23: 1025      post     Sig9 1.0000000
  24: 1026      post     Sig9 1.0000000
        V1 treatment variable     value
  
  ggboxplot(my_data,
            x = "treatment",
            y = "value",
            color = "treatment",
            facet.by = "variable") + 
    stat_compare_means(label = "p.format")
  
  And this code generates:
  
  
original_text: 4595: <p>I have a data frame for two groups and 9 variables </p>
  
  <pre><code>&gt; head(aa)
    treatment variable     value
  1       pre     Sig1 0.1173863
  2       pre     Sig1 0.1888243
  3       pre     Sig1 0.2191765
  4       pre     Sig1 0.1277735
  5       pre     Sig1 0.1711712
  6       pre     Sig1 0.0000000
  &gt; class(aa)
  [1] "data.frame"
  &gt; str(aa)
  'data.frame':   1026 obs. of  3 variables:
   <span class="math-container">$ treatment: Factor w/ 2 levels "post","pre": 2 2 2 2 2 2 2 2 2 2 ...
   $</span> variable : Factor w/ 9 levels "Sig1","Sig2",..: 1 1 1 1 1 1 1 1 1 1 ...
   $ value    : num  0.117 0.189 0.219 0.128 0.171 ...
  &gt; tail(aa)
       treatment variable value
  1021      post     Sig9     0
  1022      post     Sig9     0
  1023      post     Sig9     0
  1024      post     Sig9     0
  1025      post     Sig9     0
  1026      post     Sig9     0
  &gt;
  </code></pre>
  
  <p>I am using this code</p>
  
  <pre><code>library(ggpubr)
  &gt; p &lt;- ggboxplot(aa, x = "variable", y = "value",color = "treatment")
  &gt; my_comparisons &lt;- c("pre","post")
  &gt; p + stat_compare_means(comparisons = my_comparisons)+ stat_compare_means(label.y = 50)  
  Warning message:
  Computation failed in `stat_signif()`:
  missing value where TRUE/FALSE needed 
  &gt; 
  </code></pre>
  
  <p>But I am getting this weird plot</p>
  
  <p><a href="https://i.stack.imgur.com/72a87.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/72a87.png" alt="enter image description here"></a></p>
  
  <p>While something like this is my goal</p>
  
  <p><a href="https://i.stack.imgur.com/kI85K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kI85K.png" alt="enter image description here"></a></p>
  
  <p>I really don't know where I am doing wrong</p>
  
  <p>I used ggplot where I got something like this but I need statistics that is why I have stuck on this </p>
  
  <p><a href="https://i.stack.imgur.com/XM5WB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XM5WB.png" alt="enter image description here"></a></p>
  
  <p>I then used this code </p>
  
  <pre><code>&gt; DF &lt;- aa %&gt;% pivot_longer(.,cols = c(Sig1,Sig2,Sig3, Sig4,Sig5,Sig6,Sig7,Sig8,Sig9), names_to = "var", values_to = "val")
  &gt; View(DF)
  &gt; library(ggplot2)
  &gt; library(ggpubr)
  &gt; ggplot(DF, aes(x = treatment, y = val, fill = treatment))+
  +     geom_boxplot()+
  +     stat_compare_means(comparisons = c("pre","post")+
  +     stat_compare_means()+
  +     facet_grid(var~., scales = "free")
  + 
  </code></pre>
  
  <p>But I got another weird plot</p>
  
  <p><a href="https://i.stack.imgur.com/pLvl1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pLvl1.png" alt="enter image description here"></a></p>
  
  <p>But changing the scale I got this but gives one statistics</p>
  
  <p><a href="https://i.stack.imgur.com/mZMhI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mZMhI.png" alt="enter image description here"></a></p>
  
  <p>While I need one stat for each variable between pre and post groups</p>
  
  <p>This solution gives to statistics</p>
  
  <pre><code>&gt; p &lt;- ggboxplot(aa, x = "variable", y = "value",color = "treatment",facet.by = "variable")
  &gt; p + stat_compare_means(comparisons = my_comparisons)+ stat_compare_means(label.y =2)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/2C08u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2C08u.png" alt="enter image description here"></a></p>
  
  <p>When I edited my code</p>
  
  <pre><code>&gt; p &lt;- ggboxplot(aa, x = "variable", y = "value",color = "treatment")
  &gt; p + stat_compare_means(aes(group = variable))
  &gt; 
  </code></pre>
  
  <p>But again one stat</p>
  
  <p><a href="https://i.stack.imgur.com/hoxit.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hoxit.png" alt="enter image description here"></a></p>
   3541: <p>The problem is the scale used: For the plot you called "weird" (first from the top), the scale is 50 and for the "ggplot only" (third from the top) the scale is 1.</p>
  
  <p>You should play with the <code>stat_compare_means(label.y = 50)</code> bit, you can try setting the <code>label.y</code> parameter to 1.5 or 2.</p>
  
  <p>EDIT BECAUSE OF THE ADDITIONAL REMARKS ON THE QUESTION:</p>
  
  <p>Once again (and for sure the last time), I had to manually create example data as OP ignores repeated reminders on <a href="https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example">how to make a reproducible example with R</a>.</p>
  
  <pre><code>library(data.table)
  library(ggpubr)
  
  text &lt;- "
  treatment variable     value
  1       pre     Sig1 0.1173863
  2       pre     Sig1 0.1888243
  3       pre     Sig1 0.2191765
  4       pre     Sig1 0.1277735
  5       pre     Sig1 0.1711712
  6       pre     Sig1 0.0000000
  1       post     Sig1 0.1173863
  2       post     Sig1 0.1888243
  3       post     Sig1 0.2191765
  4       post     Sig1 0.1277735
  5       post     Sig1 0.1711712
  6       post     Sig1 0.0000000
  1021      pre     Sig9     0
  1022      pre     Sig9     0
  1023      pre     Sig9     0
  1024      pre     Sig9     0
  1025      pre     Sig9     0
  1026      pre     Sig9     0
  1021      post     Sig9     1
  1022      post     Sig9     1
  1023      post     Sig9     1
  1024      post     Sig9     1
  1025      post     Sig9     1
  1026      post     Sig9     1
  "
  my_data &lt;-fread(text)
  
  &gt; my_data
        V1 treatment variable     value
   1:    1       pre     Sig1 0.1173863
   2:    2       pre     Sig1 0.1888243
   3:    3       pre     Sig1 0.2191765
   4:    4       pre     Sig1 0.1277735
   5:    5       pre     Sig1 0.1711712
   6:    6       pre     Sig1 0.0000000
   7:    1      post     Sig1 0.1173863
   8:    2      post     Sig1 0.1888243
   9:    3      post     Sig1 0.2191765
  10:    4      post     Sig1 0.1277735
  11:    5      post     Sig1 0.1711712
  12:    6      post     Sig1 0.0000000
  13: 1021       pre     Sig9 0.0000000
  14: 1022       pre     Sig9 0.0000000
  15: 1023       pre     Sig9 0.0000000
  16: 1024       pre     Sig9 0.0000000
  17: 1025       pre     Sig9 0.0000000
  18: 1026       pre     Sig9 0.0000000
  19: 1021      post     Sig9 1.0000000
  20: 1022      post     Sig9 1.0000000
  21: 1023      post     Sig9 1.0000000
  22: 1024      post     Sig9 1.0000000
  23: 1025      post     Sig9 1.0000000
  24: 1026      post     Sig9 1.0000000
        V1 treatment variable     value
  
  ggboxplot(my_data,
            x = "treatment",
            y = "value",
            color = "treatment",
            facet.by = "variable") + 
    stat_compare_means(label = "p.format")
  </code></pre>
  
  <p>And this code generates:</p>
  
  <p><a href="https://i.stack.imgur.com/3n2Xn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3n2Xn.png" alt="enter image description here"></a></p>
  