How to remove outliers in boxplot in R? [duplicate]

房东的猫 提交于 2019-12-03 07:44:14

问题


Possible Duplicate:
Changing the outlier rule in a boxplot

I need to visualize my result using box-plot.

x<-rnorm(10000)
boxplot(x,horizontal=TRUE,axes=FALSE)

How can i filter outliers during visualisation?

(1) So that i can have full image on screen without having ugly outliers.

http://postimage.org/image/szzbez0h1/a610666d/

(2) Is there any way to show outliers upto certain range? http://postimage.org/image/np28oee0b/8251d102/

Regards


回答1:


See ?boxplot for all the help you need.

 outline: if ‘outline’ is not true, the outliers are not drawn (as
          points whereas S+ uses lines).

boxplot(x,horizontal=TRUE,axes=FALSE,outline=FALSE)

And for extending the range of the whiskers and suppressing the outliers inside this range:

   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.

# change the value of range to change the whisker length
boxplot(x,horizontal=TRUE,axes=FALSE,range=2)


来源:https://stackoverflow.com/questions/14207739/how-to-remove-outliers-in-boxplot-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!