Description Usage Arguments Examples
View source: R/data_expectations.R
Check if there are any NA values in a data frame, or specified column, within a tolerance
1 2 | expect_no_nas(df, test_column = NA, na_tolerance = 0,
return_df = TRUE)
|
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) |
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.