powered by
Checks that the fraction of non-NA values meets a threshold. Useful after joins to verify expected coverage.
lock_coverage(.data, threshold, ..., .strict = FALSE)
Invisibly returns .data (for piping).
.data
A data frame.
Minimum fraction of non-NA values (0 to 1).
Column names (unquoted) to check. If empty, checks all columns.
If TRUE, error on failure. If FALSE (default), warn.
TRUE
FALSE
df <- data.frame(id = 1:10, x = c(1:8, NA, NA)) lock_coverage(df, 0.8, x) lock_coverage(df, 0.9, x) # warns (only 80% coverage)
Run the code above in your browser using DataLab