# Check that every 4-cylinder car has an engine displacement of < 100 cubic
# inches AND < 100 horsepower - return a data frame
chk_filter(
mtcars,
c("disp", "hp"),
chk_range,
cyl == 4,
list(min = 0, max = 100)
)
# Check that every 4-cylinder car has an engine displacement of < 100 cubic
# inches AND < 100 horsepower
chk_filter_all(
mtcars,
c("disp", "hp"),
chk_range,
cyl == 4,
list(min = 0, max = 100)
)
# Check that every 4-cylinder car has an engine displacement of < 100 cubic
# inches OR < 100 horsepower
chk_filter_any(
mtcars,
c("disp", "hp"),
chk_range,
cyl == 4,
list(min = 0, max = 100)
)
# Check that columns made up of whole numbers are binary
chk_filter_all(
mtcars,
where(~ all(. %% 1 == 0)),
chk_values,
TRUE,
list(0:1)
)
Run the code above in your browser using DataLab