Skip to contents

Check for Element

Usage

has(x, ...)

# S3 method for class 'Container'
has(x, elem, ...)

# S3 method for class 'dict.table'
has(x, column, ...)

Arguments

x

any R object.

...

additional arguments to be passed to or from methods.

elem

some element to be found.

column

vector of values with the same length as the number of rows of the dict.table.

Value

TRUE if element is in x and otherwise FALSE.

For dict.table, TRUE if column exists in x otherwise FALSE.

See also

Examples


co = container(1, 2, mean)
has(co, 1)                   # TRUE
#> [1] TRUE
has(co, mean)                # TRUE
#> [1] TRUE
has(co, 1:2)                 # FALSE
#> [1] FALSE

dit = dict.table(a = 1:3, b = as.list(4:6))
has(dit, 1:3)            # TRUE
#> [1] TRUE
has(dit, 4:6)            # FALSE
#> [1] FALSE
has(dit, as.list(4:6))   # TRUE
#> [1] TRUE