Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

melt_quanteda_dict

Convert a quanteda dictionary to a long data.table format


Description

This is used internally in the tCorpus dictionary search functions, but can be used manually for more control. For example, adding numeric scores for sentiment dictionaries, and specifying which label/code to use in search_dictionary().

Usage

melt_quanteda_dict(dict, column = "code", .index = NULL)

Arguments

dict

The quanteda dictionary

column

The name of the column with the label/code. If dictionary contains multiple levels, additional columns are added with the suffix _l[i], where [i] is the level.

.index

Do not use (used for recursive melting)

Value

A data.table

Examples

d = quanteda::data_dictionary_LSD2015
melt_quanteda_dict(d)

corpustools

Managing, Querying and Analyzing Tokenized Text

v0.4.10
GPL-3
Authors
Kasper Welbers and Wouter van Atteveldt
Initial release
2022-05-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.