View source: R/frequency_table_creator.R
frequency_table_creator | R Documentation |
This function takes a dataframe with needed documents as an input and outputs a table with frequencies of each word in each of the two corpora. The output contains the list of all words in two corpora and the frequencies in the target and the reference corpus. The target corpus is defined by specifying the grouping variable (denoting belonging of documents to corpora) and the target value of the grouping variable (where the documents with the matching value of the grouping variable are sorted into the target corpus, while all the remaining documents are sorted into the refeence corpus).
frequency_table_creator( df, text_field = NULL, grouping_variable = NULL, grouping_variable_target = NULL, lemmatize = FALSE, remove_punct = FALSE, remove_symbols = FALSE, remove_numbers = FALSE, remove_url = FALSE )
df |
a |
text_field |
a string; the name of the variable storing text |
grouping_variable |
a string; the name of the variable to be be used in the creation of the target and reference corpora. It's values are used to group the documents into corpora and calculate appropriate frequencies. |
grouping_variable_target |
a string; the value of the variable to use to create the target corpus. All the other values of this variable will be grouped into a reference corpus. |
lemmatize |
logical; if |
remove_punct |
logical; if |
remove_symbols |
logical; if |
remove_numbers |
logical; if |
remove_url |
logical; if |
Relies on textstem package for lemmatization and quanteda package for frequency calculation
A dataframe with word frequencies in the target and reference corpora.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.