R: Create a Trie

trie {triebeard} | R Documentation

## Create a Trie

### Description

`create_trie` creates a trie (a key-value store optimised for matching) out of a provided character vector of keys, and a numeric, character, logical or integer vector of values (both the same length).

### Usage

    trie(keys, values)

### Arguments

`keys` | a character vector containing the keys for the trie.
`values` | an atomic vector of any type, containing the values to pair with `keys`. Must be the same length as `keys`.

### Value

a 'trie' object.

### See Also

`trie_add` and `trie_remove` for adding to and removing from tries after their creation, and `longest_match` and other match functions for matching values against the keys of a created trie.

### Examples

    # An integer trie
    int_trie <- trie(keys = "foo", values = 1)

    # A string trie
    str_trie <- trie(keys = "foo", values = "bar")

[Package triebeard version 0.3.0 Index]