example_data <- data.frame(x = 1:5, y = 6:10)
# Test a dataframe for specific conditions
example_data |>
check_that(
all(x > 0),
!any(y < 5)
)
# Use .d pronoun to test aspect of entire dataframe
example_data |>
check_that(
nrow(.d) == 5,
"x" %in% names(.d)
)
Run the code above in your browser using DataLab