0

I have a problem where I need to print the name of the outlier on the bottom boxplot. This code in R outputs the following graph. Please help. Thanks.

ggplot(data=Caschool, mapping=aes(x=expnstu, y=grspan)) + geom_boxplot() + stat_summary(fun=mean, geom="point", color="red", size=3) + stat_summary(fun=median, geom="point", color="blue", size=3)

Plot

mkIV
  • 1

1 Answers1

0

You can use Boxplot() function from car package

library(car)
Boxplot(~income, data=Prestige, id.n=Inf) # identify all outliers
Boxplot(income ~ type, data=Prestige, at=c(1, 3, 2))

See documentation: https://www.rdocumentation.org/packages/car/versions/2.1-4/topics/Boxplot

TarJae
  • 72,363
  • 6
  • 19
  • 66