0

Is there a simple way to label boxplot outliers from within the boxplot command in ggplot2 (using ggpubr)? I am seeking to identify outliers for each variable on frequency boxplots. Previous answers do NOT address this type of boxplot. My x variable is mhi and my y variable is postest. My boxplot code is:

...
par(mfrow = c(1, 2))  
boxplot(covid$mhi,
        main = "mhi", 
        sub = paste("Outlier rows: ", boxplot.stats(covid$mhi)$out))  
boxplot(covid$postest, 
        main = "positive test rate", 
        sub = paste("Outlier rows: ", boxplot.stats(covid$postest)$out))  
...

Thank you!

seagullnutkin
  • 311
  • 1
  • 10
Mike
  • 1
  • 1

1 Answers1

0

I found a partial solution, using the car package. Very simply,

Boxplot(covid$mhi, data=covid,labels=rownames(covid))

In this case, the rownames are simply the numbers of each entry in the column (covid$mhi) in the dataset. Now, how would I label each outlier with the corresponding designation in my first column, zipcode? enter image description here

Mike
  • 1
  • 1