This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to mark significance in R-making boxplot

I used one Excel input to do boxplot, and the code is real simple and effective, which led me to a looking-good figure. The code:

boxplot(NSN$`NN`~NSN$C,main="NNBI",ylab="CN",xlab="CR",col=c("blue","red"),ylim=c(0,50000))

But later I tried to mark the significant difference level among boxplots, and after searching I found a package called"ggpubr". So I run the code as instructed and get the errors as following:

> ggboxplot(NSN)
Error in .check_data(data, x, y, combine = combine | merge != "none") : 
  x and y are missing. In this case data should be a numeric vector.
> ggboxplot(NSN, x = "CR", y = "CN",merge = FALSE)
Error in `[.data.frame`(data, , x) : undefined columns selected.

Here I have two questions, 1.Generally speaking, for Excel input, how can I turn to numeric format so that I can calculate the differences among data? 2.How can I get the significance marked in boxplot here?

r

1 answer

Based on your boxplot() code, your columns of interest are NN and C. You should be using those for ggboxplot(). You are using CR and CN.

Log in to answer this question.