Skip to contents

Examine highest per-term per-topic probabilities.

Usage

examine_top_terms(data, top_n, ...)

Arguments

data

A tidy data frame that includes per-term per-topic probabilities (beta).

top_n

A number of highest per-term per-topic probabilities in each document (number of top_n can be changed).

...

Further arguments passed to dplyr::group_by.

Value

A tibble (data frame) object with a list of word probabilities from tidytext::tidy. The result is a data frame containing word probabilities for each topic.

Examples

suppressWarnings({
if(requireNamespace("quanteda", "tidytext")){
dfm <- SpecialEduTech %>%
       preprocess_texts(text_field = "abstract") %>%
       quanteda::dfm()
data <- tidytext::tidy(stm_15, document_names = rownames(dfm), log = FALSE)
data %>% examine_top_terms(top_n = 5) %>%
dplyr::mutate_if(is.numeric, ~ round(., 3)) %>%
DT::datatable(rownames = FALSE)
}
})