Learn R Programming

r2r (version 0.1.1)

has_key: Key existence in hash tables

Description

This generics are used to check whether a key exists in a given hashset or hashmap.

Usage

has_key(x, key)

x %has_key% key

# S3 method for r2r_hashmap has_key(x, key)

# S3 method for r2r_hashset has_key(x, key)

Arguments

x

an hashset or hashmap.

key

an arbitrary R object. Key to be checked for existence in the hash table.

Value

TRUE or FALSE.

Examples

Run this code
# NOT RUN {
m <- hashmap(list("a", 1), list("b", 2))
has_key(m, "a")
m %has_key% "b"
# }

Run the code above in your browser using DataLab