count_lexicon: Count hits in a lexicon

View source: R/NAME_count_lexicon.R

count_lexiconR Documentation

Count hits in a lexicon

Description

Counts the number of times a string is detected in a lexicon, according to a (regex) pattern

Usage

count_lexicon(txt, lexicon)

Arguments

txt

String in which the occurences of words from lexicon should be counted

lexicon

vector of target words which should be counted in text

Value

string

Examples

my_txt <- c("Hello you! Too bad you are not here")
my_dict <- c("Bad", "good")
count_lexicon(my_txt, my_dict)
1

sebastiansauer/prada documentation built on Jan. 17, 2024, 11:05 a.m.