#Outlier Removal Function remove_outliers <- function(dataframe, column, na.rm = TRUE) { Q1 <- quantile(column, .25) Q3 <- quantile(column, .75) IQR <- IQR(column) dataframe <- subset(dataframe, column> (Q1 - 1.5*IQR) & column< (Q3 + 1.5*IQR)) } #Not looping df_1 <-remove_outliers(df_1,df_1$Column1) #Loop through a list of column names for(i in Column_List){ df_1 <- remove_outliers(df_1, df_1[[i]]) }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter