On 02/14/2014 07:52 PM, Bogdan Tanasa wrote:
Dear all,

a simple question about boxplot() function,
on how not to display a set of values (outliers), but keep the same median
of the original dataset on the display ;

more precisely :


given a dataset : 1,2,3,4,5,6, 100, 200,300
the median is : 5

after removing the extreme values : 100, 200, 300
the median is 3.5,

but would still like to display a boxplot with median of 5. would this be
possible ? thank you !

Hi bogdan,
You could do something like this:

x<-c(1,2,3,4,5,6,100,200,300)
x_box<-boxplot(x,plot=FALSE)
x_box$stats<-matrix(c(1,3,5,5.5,6),ncol=1)
x_box$out<-NA
bxp(x_box)

Note that the "box" may not represent what you want.

Jim

______________________________________________
R-help@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.

Reply via email to