View source: R/get_topics_by_terms.R
get_topics_by_terms | R Documentation |
search a gamma_terms object for a speicific word or two
get_topics_by_terms(gamma_terms, search_words, terms_col, n = 7, ...)
gamma_terms |
a tibble or dataframe containing terms by gamma by topic |
search_words |
a character string or vector of the word or words to search for |
terms_col |
the column containing the terms, which will be separated into n columns |
n |
the number of words to keep in for each topic, |
... |
additional arguments passed |
a tibble with columns "topic", "gamma", "term_1", ..., "term_n"
Columns term_1, term_2, ..., term_n will be created by the function, as terms_col is separated to make a separate column for each value in 1 to n
## Not run:
data("tm_ex_dat")
td_beta <- get_td_beta(tm_ex_dat$topic_model_test)
top_n_beta <- get_top_n_beta_terms(td_beta)
td_gamma <- get_td_gamma(tm_ex_dat$topic_model_test)
my_gamma_terms <- get_gamma_terms(top_n_beta, td_gamma)
get_topics_by_terms(my_gamma_terms, search_words = c("government", "taliban"), terms)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.