run_dictionary: Calculate dictionary expression mentions in a text.

View source: R/analyse.R

run_dictionaryR Documentation

Calculate dictionary expression mentions in a text.

Description

This function creates a data.frame which includes one column with each observation's ID as well as one column for each category of the inputted dictionary.

Usage

run_dictionary(data, text, dictionary, verbose = TRUE)

Arguments

data

An object of type data.frame.

text

The name of the character variable for which dictionary expressions are to be matched against.

dictionary

An object of type dictionary.

verbose

TRUE or FALSE Whether activity messages are displayed on the screen.

Value

A data.frame which includes one more column than the number of dictionary categories. The first column is named doc_id. Each other column is named after a dictionary category.

Author(s)

CLESSN

Examples


## Not run: 

# Calculate the number of dictionary expression mentions in
a list of attitudes.

run_dictionary(data.frame(colnames(attitude)),
text = colnames(attitude),
dictionary = quanteda::data_dictionary_LSD2015)

## End(Not run)

clessn/clessn-verse documentation built on Feb. 18, 2024, 12:42 p.m.