Learn R Programming

hash (version 3.0.1)

keys: keys - get/set key(s) from a hash

Description

Returns the key(s) from a hash

Usage

keys(x)

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

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

keys(x) <- value

Arguments

Value

For keys and names, a character vector of key names For the replacement methods keys<-, a hash object with the keys renamed to value

docType

methods

Details

Returns the character vector containing the keys of a hash object.

See Also

setkeys : rename specific hash keys. hash : hash object

Examples

Run this code
h <- hash( letters, 1:26 )
  keys(h)  # letters

  names(h) # same

  #' Rename keys
  # keys( h ) <- rev( keys(h) )

Run the code above in your browser using DataLab