check_cols_empty: Check for empty columns

Description Usage Arguments Value Examples

View source: R/check-cols-empty.R

Description

Check for empty columns in the data and warn (or fail) if present. The function takes in a list of required column names that are not tested for emptiness. This is due to the existing function check_cols_complete(), which ensures that the required columns are complete. By ignoring the required columns in check_cols_empty(), there are no duplicated results for the same column in the event that a required column was also empty.

Usage

1
2
3
4
5
6
7
8
check_cols_empty(
  data,
  empty_values = c(NA, ""),
  required_cols = NULL,
  strict = FALSE,
  success_msg = "No columns are empty",
  fail_msg = "Some columns are empty"
)

Arguments

data

Data to check

empty_values

Values that are considered empty. Defaults to NA and "".

required_cols

A character vector of the required columns to check for completeness.

strict

If FALSE, return a "check_warn" object; if TRUE, return a "check_fail" object

success_msg

Message indicating the check succeeded.

fail_msg

Message indicating the check failed.

Value

A condition object indicating whether the data contains columns that are empty.

Examples

1
2
dat <- data.frame(specimenID = c("x", "y"), organ = c(NA, NA))
check_cols_empty(dat)

dccvalidator documentation built on July 2, 2020, 4:05 a.m.