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
We can remove outliers in R by setting the outlier. shape argument to NA. In addition, the coord_cartesian() function will be used to reject all outliers that exceed or below a given quartile. The y-axis of ggplot2 is not automatically adjusted.
Firstly, we find first (Q1) and third (Q3) quartiles. Then, we find interquartile range (IQR) by IQR() function. In addition, we calculate Q1 – 1.5*IQR to find lower limit and Q3 + 1.5*IQR to find upper limit for outliers. Then, we use subset() function to remove outliers.
To remove outliers from a data frame, we use the Interquartile range (IQR) method. This method uses the first and third quantile values to determine whether an observation is an outlier to not.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With