This function removes outlier rows from a data frame by identifying rows with values that are more than 2 standard deviations away from the mean in any column.
fix_outliers(df)
A data frame to clean
A cleaned data frame with outlier rows removed
df <- data.frame(x = c(1,2,3,4,5,6,7,8,9,10),
y = c(1,1,1,1,1,1,1,100,1,1))
fix_outliers(df)
#> No extreme values found in the numerical columns of the data.
#> x y
#> 2 2 1
#> 4 4 1
#> 6 6 1
#> 10 10 1