[R] Boxplot not doing what I think it should

Lewis Berman liberman at loyola.edu
Thu Feb 24 16:37:30 CET 2011


My box plot below is drawing its upper whisker all the way to the last point, instead of showing the point as an outlier. Am I misunderstanding, or is it a bug?

Help(boxplot) states for the parameter “range” that “this determines how far the plot whiskers extend out from the box. If range is positive, the whiskers extend to the most extreme data point which is no more than range times the interquartile range from the box. A value of zero causes the whiskers to extend to the data extremes.”

To my understanding, the code below, which drew the boxplot, should have drawn the right-hand whisker only to 387 and shown 496 as an outlier point. But it didn't. Using a range of 1.3 does. Horizontal versus vertical does not matter.

Also, the right edge of the box does not show the same 3rd Quartile as does “summary.” Explain, please.


> sort(t5g24times)
[1] 111 135 201 234 283 283 284 285 300 370 387 496
> summary(t5g24times)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
  111.0   225.8   283.5   280.8   317.5   496.0
> iqr <- 317.5 - 225.8
> iqr
[1] 91.7
> 317.5 + 1.5 * iqr
[1] 455.05
> pdf()
> boxplot(c(t5g24times), horizontal=1, range=1.5)


R version info:
platform       x86_64-apple-darwin9.8.0     
arch           x86_64                       
os             darwin9.8.0                  
system         x86_64, darwin9.8.0          
status                                      
major          2                            
minor          12.0                         
year           2010                         
month          10                           
day            15                           
svn rev        53317                        
language       R                            
version.string R version 2.12.0 (2010-10-15)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 5757 bytes
Desc: image001.png
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110224/679783be/attachment.png>


More information about the R-help mailing list