R/fct_checks.R

#' Check for empty columns in data frame
#'
#' @description
#'
#' Check whether variables in data frame have values other than `NA`.
#'
#' @references
#'
#' https://stackoverflow.com/questions/38088329/remove-empty-columns-from-read-csv/38088477
#'
#' @export
#'
#' @examples
#'
#' library(dplyr)
#' # remove empty columns from data frame
#' mydata <- mydata %>%
#'   select_if(has_data)
has_data <- function(x) { sum(!is.na(x)) > 0}
nrkoehler/leipzigr documentation built on June 1, 2019, 12:50 a.m.