tidy_verbatim: Create a tidy data frame with phrases from each column

Description Usage Arguments Details Value Examples

View source: R/tidy_verbatim.R

Description

This function creates a long table with one row per phrase and column. It allows the user to set the n-gram parameter (how many words per phrase) and then utilizes the tidytext library to unnest each verbatim response. Any NA responses are dropped.

Usage

1
tidy_verbatim(data, id = id, cols = selected_cols, n = 1)

Arguments

data

Data frame with the survey data

id

Unique survey id. By default, can be omitted if column is named 'id'

cols

List of column(s) to be unnested. By default, can be omitted if using vector named 'selected_cols'

n

Length of phrases, in words. By default is 1 (unigrams)

Details

It's recommended that you select your columns into a vector outside of the function call, because you will probably want to re-use that list with other functions in the package.

Value

A data frame with one row per phrase and column, with survey id.

Examples

1
2
3
data(bloom_survey)
selected_cols <- c("q19verb", "q20verb")
surveys <- tidy_verbatim(bloom_survey, n = 3)

chrisumphlett/openEndedAnalyzeR documentation built on Dec. 25, 2019, 4:10 p.m.