common_words: common_words

Description Usage Arguments Value

View source: R/common_words.R

Description

Tabulate a text column, showing the most commonly used words, optionally broken down by another demographics column(s)

Usage

1
2
3
common_words(data, column, ..., n = 3, min = 5,
  remove_stopwords = TRUE, remove = c(""), proportion = FALSE,
  lemmatise = FALSE, pretty = "no")

Arguments

data

dataframe or tibble with a row per survey response

column

name of a character column in the data frame to be tabulated

...

optional column(s) to use to split into groups

n

number indicating how many most common words to return for each group. Defaults to 3

min

number indicating the minimum number of times a word needs to appear for it to be included in output, defaults to 5

remove_stopwords

logical indicating whether to remove stopwords or not. Defaults to TRUE

remove

character vector of additional words to remove

proportion

logical indicating whether to include the proportion of responses that contained the word

lemmatise

logical indicating whether to use the textstem package to lemmatise the strings before calculating common words

pretty

one of either 'no', 'plot' or 'return'. Defaults to 'no'. 'plot' will end the function call by applying the prettify() function to the output with plot = TRUE. 'return' will apply the prettify() function with plot = FALSE.

Value

Table of most common words with the number of times they appear in each group


chrisbrownlie/surveyr documentation built on Dec. 1, 2019, 12:34 a.m.