get_topics_by_terms: search gamma_terms for words

View source: R/get_topics_by_terms.R

get_topics_by_termsR Documentation

search gamma_terms for words

Description

search a gamma_terms object for a speicific word or two

Usage

get_topics_by_terms(gamma_terms, search_words, terms_col, n = 7, ...)

Arguments

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

Value

a tibble with columns "topic", "gamma", "term_1", ..., "term_n"

Note

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

Examples

## 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)

tknoch8/topicHelpers documentation built on Nov. 11, 2023, 1:15 a.m.