Learn R Programming

bertopicr (version 0.3.6)

get_topic_info_df: Get Topic Information DataFrame

Description

This function retrieves topic information from a BERTopic model and processes it to unnest list columns, replace NA values, and consolidate columns with the same prefix.

Usage

get_topic_info_df(model, drop_expanded_columns = TRUE)

Value

A data.frame or tibble with unnested and consolidated columns.

Arguments

model

A BERTopic model object.

drop_expanded_columns

Logical. If TRUE, drops the expanded columns after consolidation. Default is TRUE.

Examples

Run this code
# \donttest{
if (exists("topic_model")) {
  topic_info_df <- get_topic_info_df(model = topic_model,
                                     drop_expanded_columns = TRUE)
  print(topic_info_df)
} else {
  message("No topic_model found. Please train or load a model first.")
}
# }

Run the code above in your browser using DataLab