outlierKD2: Original outlierKD function by By Klodian Dhana,...

View source: R/idsOutliers.R

outlierKD2R 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.

Description

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.

Usage

outlierKD2(
  df,
  var,
  rm = FALSE,
  boxplt = FALSE,
  histogram = TRUE,
  qqplt = FALSE
)

Arguments

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.

Value

The dataframe with outliers replaced by NA if rm==TRUE, or df if nothing changed

Examples

  outlierKD2(mydf, height, FALSE, TRUE, TRUE, TRUE)
  mydf = outlierKD2(mydf, height, TRUE, TRUE, TRUE, TRUE)
  mydfnew = outlierKD2(mydf, height, TRUE)

physicsland/ezids documentation built on Feb. 4, 2024, 2:13 a.m.