Description Usage Arguments Value See Also Examples
Environment based hash table useful for large vector lookups.
1 2 |
terms |
A vector of terms to undergo a lookup. |
key.match |
Either a two column data frame (if data frame supplied no key reassign needed) of a match key and reassignment column or a single vector match key. |
key.reassign |
A single reassignment vector supplied if key.match is not a two column data frame. |
missing |
Value to assign to terms not matching the key.match. |
Outputs A new vector with reassigned values.
1 2 3 4 5 6 7 8 9 10 11 12 | lookup(mtcars$carb, sort(unique(mtcars$carb)),
c('one', 'two', 'three', 'four', 'six', 'eight'))
lookup(mtcars$carb, sort(unique(mtcars$carb)),
seq(10, 60, by=10))
lookup(1:5, data.frame(1:4, 11:14))
lookup(LETTERS[1:5], data.frame(LETTERS[1:5], 100:104))
key <- data.frame(x=1:2, y=c("A", "B"))
big.vec <- sample(1:2, 3000000, T)
out <- lookup(big.vec, key)
out[1:20]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.