[R] boxplots
Joshua Wiley
jwiley.psych at gmail.com
Fri Jul 29 16:29:22 CEST 2011
Hi Martin,
As Sarah said, I do not know of any way to "change the default", but
you can certainly do it manually each time. Here is an example:
## generate some data
set.seed(10)
x <- rnorm(101)
## store boxplot results
s <- boxplot(x, plot = FALSE)
## look at them
s
## replace the stats with lower and upper quartile
s$stats[c(2, 4), 1] <- quantile(x, c(.25, .75), TRUE, type = 7)
## plot updated boxplot
bxp(s)
That said, you will still have to pick what algorithm you want for
your quartiles. This demonstrates the nine algorithms:
t(sapply(1:9, function(i) quantile(x, c(.25, .75), TRUE, type = i)))
You can find their specific details in the article:
Hyndman, R. J., & Fan, Y. (1996). Sample Quantiles in Statistical
Packages. The American Statistician, 50(4), 361 - 365.
Hope this helps,
Josh
On Fri, Jul 29, 2011 at 4:39 AM, Martin Olofsson
<martin.olofsson at zoologi.su.se> wrote:
> Hi!
>
> My name is Martin and I have a problem concerning the boxplot function in R.
> I want my boxes to be limited by the 1st and 3rd quartile and NOT the
> 'hinges' values that are the default setting in R.
> Do anyone knows if there is any command that I could do to change this
> default setting?
>
> Sincerely
>
> Martin Olofsson
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
https://joshuawiley.com/
More information about the R-help
mailing list