R/fill_outliersNA.R

Defines functions fill_outliersNA

Documented in fill_outliersNA

#' based on the base function boxplot (boxplot, or boxplot.stats) the outliers are detected and substituted with NA
#'
#' @param x   vector or colummn of matrix/dataframe. (F.e. x$Datetime or x[1])
#' @param column numeric, the column where the outliers should be removed
#' @return returns the file with removed (filled NA) outlier values
#' @export


fill_outliersNA <- function(x,column){

  boxplot <- boxplot.stats(x[column])

  outliers <- boxplot[[4]]

  outliers_unique <- unique(outliers)

  rowstofillNA <- which(x[column] %in% outliers_unique)

  x[rowstofillNA,] <- NA

  return(x)
}
plvoit/PaulsPack documentation built on Dec. 15, 2019, 10:24 p.m.