How to hide outliers in base R boxplot?

R ProgrammingServer Side ProgrammingProgramming

To hide outliers in base R boxplot, we can use range argument inside boxplot function but we will have to play with range argument. The range argument can take many values therefore, we would need to find the correct one that removes all the outliers. To understand how it works check out the Example given below −

Example

To hide outliners in base R boxplot, use the following snippet −

x<-c(-10,rpois(10,5),20)
boxplot(x)

Output

If you execute the above given snippet, it generates the following Output −

To hide outliners in base R boxplot, add the following code to the above snippet −

x<-c(-10,rpois(10,5),20)
boxplot(x,range=4)

Output

If you execute all the above given snippets as a single program, it generates the following Output −

raja
Published on 05-Nov-2021 06:54:45
Advertisements