clear: Removes all key-value pairs from a hash

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

clear removes all key-values from a hash.

Usage

1
2
3
4
clear(x)

## S4 method for signature 'hash'
clear(x)

Arguments

x

A hash object.

Details

clear removes (rm) the key-value pairs on the hash. For large hashes it might be faster to reinitialize the hash, though this might cause memory leaks.

Value

None. Method clear exists entirely for its side effects.

Note

clear should be called prior to removing a hash. This ensures that the memory from the environment is freed.

Author(s)

Christopher Brown

See Also

Examples

1
2
3
4
  h <- hash( letters, 1:26 )
  h # An object of type 'hash' containing 26 key-value pairs.
  clear(h)  
  h # An object of type 'hash' containing 0 key-value pairs.

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