check_cols_complete: Check for complete columns

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

check_cols_completeR Documentation

Check for complete columns

Description

Check for complete columns in the data and fail (or warn) if incomplete. Missing columns that are required to be complete are ignored.

Usage

check_cols_complete(
  data,
  required_cols,
  empty_values = c(NA, ""),
  strict = TRUE,
  success_msg = "There is no missing data in columns that are required to be complete",
  fail_msg = "There is missing data in some columns that are required to be complete"
)

Arguments

data

Data to check

required_cols

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

empty_values

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

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 not complete.

Examples

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

Sage-Bionetworks/dccvalidator documentation built on May 7, 2022, 10:32 a.m.