#' print_vector.
#'
#' @param x input character vector
#' @return the input string formatted as in an english sentence
#' @export
#' @examples
#' print_vector(letters)
#' print_vector(letters, oxford.comma = F)
print_vector <- function(x, oxford.comma = T) {
ifelse(test = oxford.comma,
yes = paste(paste0(c(head(x, -1), "and"), collapse = ", "), tail(x, 1)),
no = paste(paste0(head(x, -1), collapse = ", "), "and", tail(x, 1))
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.