Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


sts (version 1.4)

printTopWords: Print Top Words that Load Heavily on each Topic

Description

Prints the top words for each document for low, average, and high levels of sentiment-discourse

Usage

printTopWords(object, n = 10, lowerPercentile = 0.05, upperPercentile = 0.95)

Arguments

object

Model output from sts

n

number of words to print to console for each topic

lowerPercentile

Percentile to calculate a representative negative sentiment document.

upperPercentile

Percentile to calculate a representative positive sentiment document.

Examples

Run this code
# \donttest{
#Examples with the Gadarian Data
library("tm"); library("stm"); library("sts")
temp<-textProcessor(documents=gadarian$open.ended.response,
metadata=gadarian, verbose = FALSE)
out <- prepDocuments(temp$documents, temp$vocab, temp$meta, verbose = FALSE)
out$meta$noTreatment <- ifelse(out$meta$treatment == 1, -1, 1)
## low max iteration number just for testing
sts_estimate <- sts(~ treatment*pid_rep, ~ noTreatment, out, K = 3, maxIter = 2)
printTopWords(sts_estimate)
# }

Run the code above in your browser using DataLab