preamble_rm | R Documentation |
Takes a dataframe (frequencies) and removes the usual question preambles so that you are left with only the labels you care about. For example, "What is your favorite color? - Blue" becomes "Blue"
preamble_rm(dataset, var = prompt, before_symbol = "- ")
dataset |
The name of the data frame for the function to modify, usually piped in after running freqs. You almost never need any arguments in this function. |
var |
DEFAULT = prompt; If you use the prompt = TRUE argument in freqs(), this default should be perfect for you. |
before_symbol |
DEFAULT = "- "; preamble_rm will remove everything before this symbol or string of symbols |
frequencies <- tibble::tibble(
label = c('Selected','Selected','Selected','Selected','Selected'),
result = c(.25, .15, .20, .10, .30),
prompt = c(
'What is your favorite color? - Blue',
'What is your favorite color? - Green',
'What is your favorite color? - Yellow',
'What is your favorite color? - Purple',
'What is your favorite color? - Orange'
),
prompt2 = c(
'What is your favorite color? ... Blue',
'What is your favorite color? ... Green',
'What is your favorite color? ... Yellow',
'What is your favorite color? ... Purple',
'What is your favorite color? ... Orange'
)
)
preamble_rm(frequencies)
preamble_rm(frequencies, var = prompt2, before_symbol = '\\. ')
frequencies %>% preamble_rm()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.