vector.print.with.and {veccompare} | R Documentation |
Print a vector with commas and a final "and".
Description
Print a vector with commas and a final "and".
Usage
vector.print.with.and(vector_to_print,
string_to_return_if_vector_is_empty = "", use_oxford_comma = TRUE)
Arguments
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"). |
Value
A single string that concatenates the input, separating with commas and adding "and" before the final item.
Examples
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 ""
[Package veccompare version 0.1.0 Index]