Skip to contents

Serves both sframe_run_topic_model_lda() and sframe_run_stm_topics() results with no dispatch on result$test: both runners emit a $table with the same topic/term/beta columns (LDA's beta from tidytext::tidy(), STM's from its fitted word-topic distribution), so this function reads that shared shape directly.

Usage

sframe_plot_topics(result, palette = c("web", "print"))

Arguments

result

A topic_model_lda or stm_topics result list from run_analysis_plan().

palette

One of "web" or "print". See sframe_brand().

Value

A ggplot2 object, or NULL when the result carries no usable table.

Examples

# \donttest{
if (requireNamespace("ggplot2", quietly = TRUE) &&
    requireNamespace("stm", quietly = TRUE) &&
    requireNamespace("tidytext", quietly = TRUE)) {
  demo <- sframe_demo("open_text")
  res <- run_analysis_plan(demo$responses, demo$instrument)
  sframe_plot_topics(res$RQ10)
}
#> Warning: K=2 is equivalent to a unidimensional scaling model which you may prefer.

# }