Learn R Programming

hash (version 3.0.1)

has.key: Test for existence of key(s) on a hash

Description

has.key returns a logical vector as long as keys, indicating which keys are defined on the hash.

Usage

has.key(key, hash, ...)

## S3 method for class 'ANY,hash': has.key(key, hash, ...)

Arguments

Value

logical A logical vector of length key indicating whether the key is defined in the hash. has.key also accepts ... to be passed to underlying sapply

docType

methods

See Also

exists hash

Examples

Run this code
h <- hash( letters, 1:26 )
    all( has.key( letters, h ) ) # TRUE

Run the code above in your browser using DataLab