df1 <- data.frame(
id = 0:99,
binomial = sample(0:1, 100, TRUE),
even = abs(0:99%%2 - 1) * 0:99
)
df2 <- data.frame(
id = 0:99,
binomial = sample(0:1, 100, TRUE),
odd = 0:99%%2 *0:99
)
# Check that same records 'succeeded' across data frames
try(expect_valmatch(df2, binomial, by = "id", data = df1))
# Check that all records in `df1`, as picked out by `id`, exist in `df2`
expect_subset(df2, by = "id", data = df1)
Run the code above in your browser using DataLab