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

Description Usage Arguments Examples

View source: R/assertions.R

Description

Check whether a vector are all elements of another vector

Usage

1
2
3
all_in(x, table)

x %all_in% table

Arguments

x

The values to be matched.

table

The values to be matched against.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## 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 May 6, 2019, 1:03 a.m.