Skip to contents

Create a table of per-document per-topic probabilities.

Usage

topic_probability_table(data, top_n, ...)

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 tibble (data frame) object with a list of topic probabilities from tidytext::tidy. The result is a ggplot object representing the topic-term plot.

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_table(top_n = 15) %>% DT::datatable(rownames = FALSE)
}
})