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

Description Usage Arguments Details Value See Also Examples

View source: R/has_key.R

Description

Note: has.key() will be replaced by has_key() in the future. '

Usage

1
2
3
4
5
6
has_key(hash, key, ...)

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

## S4 method for signature 'ANY,hash'
has.key(key, hash, ...)

Arguments

hash

hash object.

key

vector whose entries will be coerced to valid keys.

...

arguments passed to sapply.

Details

has_key indicates whether the key exists on the hash.

has_key is a wrapper around base::exists() vectorized over key using base::sapply(). Additional arguments, ... are passed to base::sapply(). The inherits method is always FALSE

has_key() is replacing has.key and switching the order of arguments. This makes has_key() more pipe-able and readable. has.key() will be deprecated in a future release.

Value

logical vector with 'length(key)“ indicating whether the key is defined in the hash.

See Also

Examples

1
2
3
    h <- hash( letters, 1:26 )
    all( has.key( letters, h ) ) # TRUE
    

decisionpatterns/r-hash documentation built on Feb. 6, 2019, 10:27 p.m.