A vector x becomes "x[1]", "x[1] and x[2]", or "x[1], x[2], and x[3]", depending on the langth of x.

paste.and(x, oq = "", cq = "", con = "and")

Arguments

x

A vector.

oq

Opening quotation symbol. (Defaults to none.)

cq

Closing quotation symbol. (Defaults to none.)

con

Conjunction to be used if length(x)>1. (Defaults to "and".)

Value

A string with the output.

See also

paste, cat

Examples


print(paste.and(c()))
#> [1] ""

print(paste.and(1))
#> [1] "1"

print(paste.and(1:2))
#> [1] "1 and 2"

print(paste.and(1:3))
#> [1] "1, 2, and 3"

print(paste.and(1:4,con='or'))
#> [1] "1, 2, 3, or 4"