Learn R Programming

hash (version 3.0.1)

clear: Removes all key-value pairs from a hash

Description

clear removes all key-values from a hash.

Usage

clear(x)

## S3 method for class 'hash': clear(x)

Arguments

Value

None. Method clear exists entirely for its side effects.

docType

methods

Details

Currently 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.

See Also

del to remove specific key-values from the hash. hash.

Examples

Run this code
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.

Run the code above in your browser using DataLab