trie_insert: Insert new key value pairs into a trie.

Description Usage Arguments Value Examples

View source: R/trie.R

Description

This can be used to insert new key-value pairs into an existing trie. It's also the engine used in trie creation

Usage

1
trie_insert(trie, key, value)

Arguments

trie

a trie to update

key

the replacement keyword

value

the value that will be used to replace keywords when using trie replace

Value

an updated trie

Examples

1
2
3
4
5
test <- c("a", "ab", "bab", "bc", "bca", "c", "caa", "abc")
values <- c("foo", "bar", "foo", "bar", "foo", "bar", "foo", "bar")
example_trie <- trie_create(test, value = values)
trie_insert(example_trie, key = "dab", value = "foo")
#'trie_insert(example_trie, key = "cad", value = "bar")

lmkirvan/textTries documentation built on May 25, 2019, 9:32 p.m.