R Boxplot - specify upper and lower whisker?

Viewed 126

The lower whisker is defined by Q1 - c * IQR and the upper whicker by Q3 + c * IQR

being Q1 - first quartile, Q3 - third quartile, IQR - inter quartile range, and C a variable. Usually C is 1.5, and I'm not sure, but probably is default for boxplot().

Is it possible to specify this C value when creating a boxplot?

Solutions using ggplot2 are welcome too.

1 Answers

I found the answer. Completely missed it reading the documentation, sorry.

It can be given as an argument in boxplot():

range

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.

boxplot(x,...,range=2)

Edit: as tjebo suggested, this post (In ggplot2, what do the end of the boxplot lines represent?) completes the answer. Altough the title has ggplot2, it mentions the solution to my problem and might be worth checking out.

Related