is_subset: Test if one set is a subset of another.

Description Usage Arguments Details Value Author(s) Examples

Description

is_subset tests if a set x is a subset of another set y

Usage

1
is_subset(x, y, tolerance = sqrt(.Machine$double.eps))

Arguments

x

A vector containing the first set.

y

A vector containing the second set.

Details

This functions takes special care of numeric input and uses %in_dbl% in this case.

Value

A logical vector of length one. It is TRUE if all the values in x are found in y and FALSE otherwise.

Author(s)

Dominik Mueller

Examples

1
2
3
4
5
6
7
x <- c(1 - 1e-9, 2 + 1e-10)
y <- c(1, 2, 3)
all(x %in% y) # returns FALSE
is_subset(x, y) # returns TRUE

is_subset(letters[1:5], letters)
is_subset(c(1L, 3L), c(1.0, 6.0, 3.0))

DominikMueller64/dmisc documentation built on May 6, 2019, 2:52 p.m.