powered by
Creates a bar chart showing the top terms for each topic, based on their beta (topic-word) probabilities.
sm_plot_topic_terms(model, n_terms = 10, topics = NULL)
A ggplot object.
A fitted topic model (LDA, STM, or CTM).
Number of top terms to display per topic. Default is 10.
Vector of topic numbers to display. If NULL, shows all topics. Default is NULL.
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