Learn R Programming

dynutils (version 1.0.11)

all_in: 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

Run this code
if (FALSE) {
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, ...
}

Run the code above in your browser using DataLab