vec_to_sentence: Vector to phrase

View source: R/functions.R

vec_to_sentenceR Documentation

Vector to phrase

Description

Turn a vector into a phrase with a final 'and' (or other separator). If sep is ";" the final is sep plus end.

Usage

vec_to_sentence(x, sep = ",", end = "and", na_rm = TRUE)

Arguments

x

Character. Vector to collapse to phrase

sep

Character. Separator between all except last

end

Character. Last separator

na_rm

Logical. Remove NA?

Value

Character.

Examples

x <- c("apples", "bannanas", "pears", NA, "grapes")
vec_to_sentence(x)
vec_to_sentence(x, end = "&")
vec_to_sentence(x, ";")
vec_to_sentence(x, na_rm = F)

Acanthiza/envFunc documentation built on Aug. 19, 2024, 4:50 a.m.