Skip to contents

Counts how often a key word occurs in Lenin's work. Considers word boundaries, optionally considers letter case.

Usage

count_lenin_mentions(
  words,
  ignore_case = TRUE,
  word_boundaries = TRUE,
  return_all_rows = FALSE
)

Arguments

words

vector of key words to search for

ignore_case

logical, should case sensitivity be considered?

word_boundaries

logical, should word boundaries be considered?

return_all_rows

logical, return all rows, or only rows with 1+ instance? It's considerably faster to only return rows with 1+ instance for large data frames and/or infrequent words.

Value

Returns the lenin data frame with two new columns added:

mentions

number of occurrences of the key word in the text column

word

key word

The data frame will be in "long" format, with a new row for each key word. If return_all_rows is set to FALSE only rows with at least one mention for one of the words