topNwords-method: Show top N words for topics/sentiments

Description Usage Arguments Value Examples

Description

This method returns a vector containing the N words with the highest estimated parameter values for any of the models estimated in this package. If topic (and sentiment for the appropriate models) are not specified, the top N words of every topic will be returned.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
topNwords(x, N, topic = NULL, sentiment = NULL)

## S4 method for signature 'JST_reversed.result,numeric,numeric,numeric'
topNwords(x, N, topic = NULL, sentiment = NULL)

## S4 method for signature 'JST_reversed.result,numeric,ANY,ANY'
topNwords(x, N)

## S4 method for signature 'JST.result,numeric,numeric,numeric'
topNwords(x, N, topic = NULL, sentiment = NULL)

## S4 method for signature 'JST.result,numeric,ANY,ANY'
topNwords(x, N)

Arguments

x

A results object from any of the models in the package

N

Integer. The number of words to return.

topic

(optional) Integer. The topic to return words from.

sentiment

(optional) Integer. The sentiment to return words from.

Value

If topic and sentiment are specified: A character vector containing the top N words for the requested topic-sentiment combination. Otherwise a data.frame containing the top N words for every topic-sentiment combination.

Examples

1
2
model <- jst(quanteda::dfm(quanteda::data_corpus_inaugural), paradigm())
topNwords(model, N = 30, topic = 2, sentiment = 1)

rJST documentation built on Feb. 13, 2020, 5:08 p.m.