R/removeNARows.R

#' @title Remove rows that exceed a specified percentage of missing values
#' @description Remove rows that exceed a specified percentage of missing values. The default is set to remove anything above 85%.
#' @param df The name of the dataframe, not in quotes, for which the columns need to be converted to character class.
#' @param pct The minimum percentage of missing data that will cause a row to be deleted.
#' @return Dataframe
#' @export
removeNARows <- function(df, pct = .85){
  df <- df[rowSums(is.na(df))/ncol(df) < pct,]
}
RonGuymon/ronsFunctions documentation built on May 8, 2019, 11:42 a.m.