top20words-method: Show top 20 words for topics/sentiments

Description Usage Arguments Value Examples

Description

This method returns a vector containing the 20 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 20 words of every topic will be returned.This method calls the generic topNwords method.

Usage

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

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

## S4 method for signature 'JST_reversed.result,ANY,ANY'
top20words(x)

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

## S4 method for signature 'JST.result,ANY,ANY'
top20words(x)

Arguments

x

A results object from any of the models in the package

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 20 words for the requested topic-sentiment combination. Otherwise a data.frame containing the top 20 words for every topic-sentiment combination.

Examples

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

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