How to mark significance in R-making boxplot
1
0
Entering edit mode
6.4 years ago
Qingyang Xiao ▴ 160

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 • 5.0k views
ADD COMMENT
1
Entering edit mode

See this post on Biostars

Boxplot in ggplot2

and if it’s not enough, go to stackoverflow.

https://stackoverflow.com/questions/29263046/how-to-draw-the-boxplot-with-significant-level?rq=1

ADD REPLY
0
Entering edit mode
6.4 years ago
igor 13k

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.

ADD COMMENT

Login before adding your answer.

Traffic: 2555 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6