Learn R Programming

SportMiner (version 0.1.0)

sm_plot_topic_frequency: Plot Topic Frequency Distribution

Description

Creates a bar chart showing how many documents are assigned to each topic.

Usage

sm_plot_topic_frequency(model, dtm, threshold = 0.3)

Value

A ggplot object.

Arguments

model

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

dtm

The document-term matrix used to train the model.

threshold

Minimum gamma probability for topic assignment. Default is 0.3.

Examples

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

Run the code above in your browser using DataLab