text_matcher: A Function for Matching Text with Exclusions

Description Usage Arguments Examples

View source: R/misc-functions.R

Description

text_matcher() returns logical vector indicating whether each element in x matches terms included in include_text. If exclude_text (character vector of words) is nonempty, text_matcher() first filters out any of the terms included in exclude_text before matching the include_text

Usage

1
text_matcher(x, include_text, exclude_text = NULL, ignore_case = TRUE)

Arguments

x

Character vector containing text to search.

include_text

Character vector containing terms to find.

exclude_text

Character vector containing terms to exclude. Defaults to NULL. If exclude_text (character vector of words) is nonempty, text_matcher() first filters out any of the terms included in exclude_text before matching the include_text

ignore_case

logical. Sets value of ignore.case in gsub and grepl.

Examples

1
textmatcher(x = c("hello", "not hello"), include_text = "hello", exclude_text = "not hello", ignore_case = TRUE)

mdilorenzo/aidtools documentation built on May 22, 2019, 3:37 p.m.