In R programming, an outlier is merely an observation that is unique in comparison with most of the other observations. An outlier is present because of errors in measurement in the data frame.
The following script is used to detect the particular outliers for each and every attribute:
> outlierKD <- function(dt, var) { + var_name <- eval(substitute(var),eval(dt)) + na1 <- sum(is.na(var_name)) + m1 <- mean(var_name, na.rm = T) + par(mfrow=c(2, 2), oma=c(0,0,3,0)) + boxplot(var_name, main="With outliers") + hist(var_name, main="With outliers", xlab=NA, ylab=NA) + outlier <- boxplot.stats(var_name)$out + mo <- mean(outlier) + var_name <- ifelse(var_name %in% outlier, NA, var_name) + boxplot(var_name, main="Without ...