Create a Term Frequency-Inverse Document Frequency analysis
Arguments
- df
A data frame
- var
Categorical variable by it's name (in characters) you want to cut by
- text_var
Text variable you are interested in (in characters)
- clean_text
Cleans text if TRUE
- ...
Further arguments to tm_clean_text
- tf_idf
output of
tm_tf_idf- N
Number of bigrams in the TF-IDF plot you want to visualize
Examples
library(janeaustenr)
library(ggplot2)
df <- austen_books()
tf_idf <- tm_tf_idf(df, var = "book", text_var = "text")
tm_tf_idf_plot(tf_idf, 15)