View source: R/make_td_thetas_df.R
make_td_thetas_df | R Documentation |
get the top most important topics, in order, for each document
make_td_thetas_df(prepped_meta_obj, id_col, topicModel,
topicModel_K, train_text, n_topics = 5)
prepped_meta_obj |
if using stm, this is the $meta dataframe in the object created by stm::prepDocuments |
id_col |
the column of prepped_meta_obj containing the unique ids for each row/document |
topicModel |
the stm topic model object to be operated on |
topicModel_K |
the number of topics K in topicModel |
train_text |
dataframe containing a column of documents to be used. This must be the dataframe/documents that were used to make topicModel |
n_topics |
the number of topics to be returned for each row/document |
a dataframe containing a row for each document that contains its most important topics
## Not run:
data("tm_ex_dat")
make_td_thetas_df(prepped_meta_obj = tm_ex_dat$train_text_prepped$meta,
id_col = id_conversation,
topicModel = tm_ex_dat$topic_model_test,
topicModel_K = tm_ex_dat$topic_model_test$settings$call$K,
train_text = tm_ex_dat$train_text)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.