Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

paste.and

Concatenates the elements of a vector (optionaly enclosing them in quotation marks or parentheses) adding appropriate punctuation and conjunctions.


Description

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.

Usage

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()))

print(paste.and(1))

print(paste.and(1:2))

print(paste.and(1:3))

print(paste.and(1:4,con='or'))

statnet.common

Common R Scripts and Utilities Used by the Statnet Project Software

v4.4.1
GPL-3 + file LICENSE
Authors
Pavel N. Krivitsky [aut, cre] (<https://orcid.org/0000-0002-9101-3362>), Skye Bender-deMoll [ctb]
Initial release
2020-10-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.