Learn R Programming

hash (version 3.0.1)

setkeys: setkeys - change/rename the keys of a hash

Description

Changes the keys of a hash from old keys to new

Usage

setkeys(x, old, new)

## S3 method for class 'hash': setkeys(x, old, new)

Arguments

Value

Invisiblly returns x with its keys renamed.

docType

methods

See Also

keys hash

Examples

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

   h2 <- copy(h)
   setkeys( h2, keys(h), paste0( keys(h), "1" ) )
   h2

   h3 <- copy(h)
   setkeys( h3, keys(h), rev( keys(h) ) )
   h3

Run the code above in your browser using DataLab