p <- ggboxplot(Base_donnees_finale, x = "N2O_agricole_MilliersTECO2", y ="Tonne équivalent CO2 à l'ha cultivable")
Add p-value
p + stat_compare_means()
But as a result I have the same boxplots than before even if I use different variables !!!
I just don't know where to put the two variables to make my boxplots.
My data base is called "Base_de_donnee_finale" and my two variables are "N2O_agricole_MilliersTECO2" and "CH4_agricole_MilliersTECO2" and to have a wilcoxon test in it.
To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:
I don't think this is going to produce the desired result because both variables seem to be numerical, and for a similar plot as in the example you would need a factor variable for the x-axis.
I can't be sure without sample data but maybe you would need to reshape your data to a long format with something like this.
library(tidyverse)
library(ggpubr)
Base_de_donnee_finale %>%
gather(key = "Parameter", value = "Value", N2O_agricole_MilliersTECO2, CH4_agricole_MilliersTECO2) %>%
ggboxplot(Base_donnees_finale, x = "Parameter", y ="Value") +
stat_compare_means()