Checks if all rows in x match at least one in y.
Value
The chk_ function throws an informative error if the test fails or
returns the original object if successful so it can used in pipes.
The vld_ function returns a flag indicating whether the test was met.
See also
For more details about the use of this function,
please read the article
vignette("chk-families").
Other misc_checkers:
chk_not_any_na(),
chk_not_empty(),
chk_unique()
Examples
# chk_join
chk_join(data.frame(z = 1), data.frame(z = 1:2), by = "z")
try(chk_join(data.frame(z = 1), data.frame(z = 2), by = "z"))
#> Error in eval(expr, envir) :
#> All rows in `data.frame(z = 1)` must match at least one in the y object of class <df[,1]>.
#> Use `rlang::last_error()$y` to show the object compared to.
# vld_join
vld_join(data.frame(z = 1), data.frame(z = 1:2), by = "z")
#> [1] TRUE
vld_join(data.frame(z = 1), data.frame(z = 2), by = "z")
#> [1] FALSE
vld_join(data.frame(z = 1), data.frame(a = 1:2), by = c(z = "a"))
#> [1] TRUE
vld_join(data.frame(z = 1), data.frame(a = 2), by = c(z = "a"))
#> [1] FALSE
