Replace outliers by quantiles in R
问题 I have been trying to replace outliers 1.5*IQR +/- upper/lower quantile by the upper and lower quantile with the following code: `lower.quantile <- as.numeric(summary(loans$dINC_A)[2]) lower.quantile [1] 9000 upper.quantile <- as.numeric(summary(loans$dINC_A)[5]) > upper.quantile [1] 21240 IQR <- upper.quantile - lower.quantile # I replace outliers by the lower/upper bound values loans$INC_A[ loans$dINC_A < (lower.quantile-1.5*IQR) ] <- lower.quantile loans$INC_A[ loans$dINC_A > (upper