R/cinf-filters.R

# Filters out columns from data frame with low variance
rm_low_var <- function(df, threshold=0.0001) {
  ind <- logical()
  ncol <- length(df)
  for (col in 1:ncol) {
    if (var(df[[col]]) < threshold) {
	  ind[col] <- FALSE
	} else {
	  ind[col] <- TRUE
	}
  }
  df[ind]
}

Try the conmolfields package in your browser

Any scripts or data that you put into this service are public.

conmolfields documentation built on May 2, 2019, 4:18 p.m.