Turn a vector into a phrase with a final 'and' (or other separator). If sep
is ";" the final is sep
plus end
.
vec_to_sentence(x, sep = ",", end = "and", na_rm = TRUE)
Character.
x <- c("apples", "bannanas", "pears", NA, "grapes")
vec_to_sentence(x)
#> [1] "apples, bannanas, pears and grapes"
vec_to_sentence(x, end = "&")
#> [1] "apples, bannanas, pears & grapes"
vec_to_sentence(x, ";")
#> [1] "apples; bannanas; pears; and grapes"
vec_to_sentence(x, na_rm = F)
#> [1] "apples, bannanas, pears, NA and grapes"