I guess there is a distinction here; one is either choosing to take the outlier value and set it to NA/missing, and leave it at that; or go an extra step and impute what the value may have been.
package mice is popular for missing values imputation i.e. the second step.
geom_boxplot documentation shows how it considers values greater than 1.5*IQR away from the outer quartiles to be outliers.
consider this example:
(mpg_compact <- filter(mpg,class=="compact")) |> select(hwy)
p <- ggplot(mpg_compact, aes(y=hwy))
p + geom_boxplot()
(myvec <- mpg_compact$hwy)
(lower_quartile <- quantile(myvec,.25))
(upper_quartile <- quantile(myvec,.75))
(IQR <- diff(range(upper_quartile,lower_quartile)))
(above <- 1.5*IQR)
(upper_whisker <- quantile(myvec,.75) + above)
#location
(is_upper_outlier <- myvec > upper_whisker)
which(is_upper_outlier)
note in this example the 3 dots seen visually are actually 4 data entries, because a pair of them are the same value (35)