write_out.Rd
Write out a list of words
write_out(word_list, quoted = FALSE, human = TRUE, separator = ifelse(sum(grepl(",", word_list)), ";", ","), placement = ifelse(human & grepl("United States", Sys.getlocale()), "US", "international"), oxford = TRUE, quote_type = c("double", "single"), curly = human, collapse = c("and", "&", "+", "or", "and/or"), ending = c("", ".", ","))
word_list | Character vector. Words to be listed out. |
---|---|
quoted | Logical. If TRUE, will wrap each word in quotation marks. |
human | Logical. If FALSE, will leave out the final conjunction. |
separator | Character. What punctuation do you want between elements? Defaults to semicolon if any element contains a comma, comma otherwise. |
placement | Character. If "US", will place commas and periods inside
any quotation marks (and other punctuation outside them).
If "international", will place all punctuation outside
quotation marks. Defaults to "US" if |
oxford | Logical. Use an Oxford comma? Defaults to TRUE. Parameter is ignored if separator is not a comma. |
quote_type | Character. "double" for double quotes, "single" for single. |
curly | Logical. TRUE for Unicode curly quotes, FALSE for straight ASCII quotes. Defaults to FALSE if human == FALSE, TRUE otherwise. |
collapse | Character. What final conjunction or sign do you want? "and", an ampersand, a plus sign, an "or", an "and/or"...? |
ending | Character (e.g. period, comma, or zero-length string). What character if any do you need inside the final quotation mark, or at the end of the function"s output? |
Character. A pretty, human-readable list.
write_out("apples")#> [1] "apples"#> [1] "apples and oranges"#> [1] "“apples” and “oranges”"#> [1] "“hello, my friend”; “welcome”; and “enter.”"#> [1] "‘apples’ and ‘oranges’"#> [1] "'apples' and 'oranges'"#> [1] "apples, oranges, and bananas"#> [1] "“apples,” “oranges,” and “bananas.”"#> [1] "apples, oranges and bananas"#> [1] "apples, oranges, or bananas"#> [1] "apples, oranges, bananas"#> character(0)