Plot per-document per-topic probabilities
Source:R/text_mining_functions.R
topic_probability_plot.Rd
Plot per-document per-topic probabilities.
Arguments
- data
A tidy data frame that includes per-document per-topic probabilities (gamma).
- top_n
A number of highest per-document per-topic probabilities (number of top_n can be changed).
- ...
Further arguments passed.
Value
A ggplot object output from stm::stm
, tidytext::tidy
, and ggplot2::ggplot
.
Examples
suppressWarnings({
if(requireNamespace("quanteda", "tidytext")){
dfm <- SpecialEduTech %>%
preprocess_texts(text_field = "abstract") %>%
quanteda::dfm()
data <- tidytext::tidy(stm_15, matrix = "gamma", document_names = rownames(dfm), log = FALSE)
data %>% topic_probability_plot(top_n = 15) %>% plotly::ggplotly()
}
})