expect_no_nas: Check if there are any NA values in a data frame, or...

Description Usage Arguments Examples

View source: R/data_expectations.R

Description

Check if there are any NA values in a data frame, or specified column, within a tolerance

Usage

1
2
expect_no_nas(df, test_column = NA, na_tolerance = 0,
  return_df = TRUE)

Arguments

test_column

character string for column to test - optional

na_tolerance

number of NA allowed before failure, default is zero

return_df

T/F whether to end function with dataframe input (as in if a check in part of a pipe)

Examples

1
2
3
4
5
6
7
8
expect_no_nas(mtcars, "cyl")
# [1] "Detected 0 NAs...OK"
expect_no_nas(mtcars)
# [1] "Detected 0 NAs...OK"
expect_no_nas(c(0, 3, 4, 5))
# [1] "Detected 0 NAs...OK"
expect_no_nas(c(0, 3, NA, 5))
# Error in expect_no_nas(c(0, 3, NA, 5)) : Detected 1 NAs

dgarmat/dgfunctionpack documentation built on May 17, 2020, 9:58 p.m.