top_term_lookup: Hash Table/Dictionary Lookup

Description Usage Arguments Value Examples

Description

Replaces the individual elements of the vector 'terms' by the reassign key (largely based on qdapTools::lookup)

Usage

1
2
top_term_lookup(terms, key.match, key.reassign = NULL,
  tokenize = FALSE)

Arguments

terms

A vector of terms to undergo a lookup

key.match

Takes one of the following:
(1) a two column data.frame of a match key and reassignment column
(2) a named list of vectors (Note: if data.frame or named list supplied no key reassign needed)
(3) a single vector match key.

key.reassign

A single reassignment vector supplied if key.match is not a two column data.frame/named list

tokenize

If TRUE terms will be first split by word boundaries and than put back together

Value

A new vector with reassigned values

Examples

1
2
3
4
5
6
library(tpfuns)
a <- c("property and plant", "property", "plant")
b <- c("property", "plant")
c <- c("replace 1", "replace 2")
top_term_lookup(a, b, c)
top_term_lookup(a, b, c, TRUE)

M-U-UNI-MA/tpfunctions documentation built on May 24, 2019, 7:37 a.m.