Check for Name

has_name(x, name)

# S3 method for Container
has_name(x, name)

# S3 method for dict.table
has_name(x, name)

Arguments

x

any R object.

name

character the name to be found.

Value

TRUE if name is in x and otherwise FALSE.

For dict.table

TRUE if the dict.table objects has the given column name, otherwise FALSE.

See also

Examples


co = container(a = 1, 2, f = mean)
has_name(co, "a")    # TRUE
#> [1] TRUE
has_name(co, "f")    # TRUE
#> [1] TRUE
has_name(co, "2")    # FALSE
#> [1] FALSE

dit = dict.table(a = 1:2, b = 3:4)
has_name(dit, "a")   # TRUE
#> [1] TRUE
has_name(dit, "x")   # FALSE
#> [1] FALSE