Learn R Programming

SportMiner (version 0.1.0)

sm_plot_topic_terms: Plot Topic Term Probabilities

Description

Creates a bar chart showing the top terms for each topic, based on their beta (topic-word) probabilities.

Usage

sm_plot_topic_terms(model, n_terms = 10, topics = NULL)

Value

A ggplot object.

Arguments

model

A fitted topic model (LDA, STM, or CTM).

n_terms

Number of top terms to display per topic. Default is 10.

topics

Vector of topic numbers to display. If NULL, shows all topics. Default is NULL.

Examples

Run this code
if (FALSE) {
# Requires trained model from sm_train_lda()
lda_model <- sm_train_lda(dtm, k = 10)
sm_plot_topic_terms(lda_model, n_terms = 15)
}

Run the code above in your browser using DataLab