sales <- data.frame(
sale_id = 1:5,
date = c("20200101", "20200101", "20200102", "20200103", "20220101"),
sale_price = c(10, 20, 30, 40, -1)
)
try(expect_values(date, 20000000:20210000, data = sales)) # Dates between 2000 and 2021
try(expect_range(sale_price, min = 0, max = Inf, data = sales)) # Prices non-negative
Run the code above in your browser using DataLab