all_in: Check whether a vector are all elements of another vector

View source: R/assertions.R

all_inR Documentation

Check whether a vector are all elements of another vector

Description

Check whether a vector are all elements of another vector

Usage

all_in(x, table)

x %all_in% table

Arguments

x

The values to be matched.

table

The values to be matched against.

Examples

## Not run: 
library(assertthat)
assert_that(c(1, 2) %all_in% c(0, 1, 2, 3, 4))
# TRUE

assert_that("a" %all_in% letters)
# TRUE

assert_that("A" %all_in% letters)
# Error: "A" is missing 1 element from letters: "A"

assert_that(1:10 %all_in% letters)
# Error: 1:10 is missing 10 elements from letters: 1L, 2L, 3L, ...

## End(Not run)

dynutils documentation built on Oct. 11, 2022, 5:07 p.m.