outlierKD2 | R Documentation |
Original outlierKD function by By Klodian Dhana, https://www.r-bloggers.com/identify-describe-plot-and-remove-the-outliers-from-the-dataset/ Modified to have third argument for removing outliers instead of interactive prompt, and after removing outlier, original df will not be changed. The function returns the a df, which can be saved as original df name if desired. Also added QQ-plot in the output, with options to show/hide boxplot, histogram, qqplot. Check outliers, and option to remove them, save as a new dataframe.
outlierKD2(
df,
var,
rm = FALSE,
boxplt = FALSE,
histogram = TRUE,
qqplt = FALSE
)
df |
The dataframe. |
var |
The variable in the dataframe to be checked for outliers |
rm |
Boolean. Whether to remove outliers or not. |
boxplt |
Boolean. Whether to show the boxplot, before and after outliers removed. |
histogram |
Boolean. Whether to show the histogram, before and after outliers removed. |
qqplt |
Boolean. Whether to show the qqplot, before and after outliers removed. |
The dataframe with outliers replaced by NA if rm==TRUE, or df if nothing changed
outlierKD2(mydf, height, FALSE, TRUE, TRUE, TRUE)
mydf = outlierKD2(mydf, height, TRUE, TRUE, TRUE, TRUE)
mydfnew = outlierKD2(mydf, height, TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.