text_dtm_prep: Prepare data for topic modelling

Description Usage Arguments Value Examples

View source: R/text_dtm_prep.R

Description

Calculate TF-IDF scores and create a Document-Term Matrix from your dataset.

Usage

1
text_dtm_prep(unnest_data, grouping_var, word_col = "word")

Arguments

unnest_data

dataframe with unnested tokens

grouping_var

column used for determining what consistutes a document; with quotation marks (string) If each response is a row, add a column with row identifiers to be the grouping_var.

word_col

column name containing the unnested tokens

Value

List containing the prepared data and a Document-Term Matrix

Examples

1
2
tidytext::unnest_tokens(dummy_response, 'word', colnames(dummy_response)[7]) %>%
text_dtm_prep(., 'response_id')

DataS-DHSC/consultations documentation built on Jan. 28, 2022, 1:56 a.m.