Description Usage Arguments Value Examples
Print a vector with commas and a final "and".
1 2 | vector.print.with.and(vector_to_print,
string_to_return_if_vector_is_empty = "", use_oxford_comma = TRUE)
|
vector_to_print |
A vector of strings (or elements able to be coerced into strings) to print. |
string_to_return_if_vector_is_empty |
If |
use_oxford_comma |
A logical (TRUE/FALSE) value indicating whether to use an Oxford comma ("One, two, and three" vs. "One, two and three"). |
A single string that concatenates the input, separating with commas and adding "and" before the final item.
1 2 3 4 5 6 | vector.print.with.and(c("One", "Two", "Three", "Four"))
vector.print.with.and(c("One", "Two", "Three", "Four"), use_oxford_comma = FALSE)
vector.print.with.and(c("One", "Two"))
vector.print.with.and(c("One"))
vector.print.with.and(c(), string_to_return_if_vector_is_empty = "(None)") # Outputs "(None)"
vector.print.with.and(c(""), string_to_return_if_vector_is_empty = "(None)") # Outputs ""
|
[1] "One, Two, Three, and Four"
[1] "One, Two, Three and Four"
[1] "One and Two"
[1] "One"
[1] "(None)"
[1] ""
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.