Learn R Programming

descutils (version 1.0)

makeEnglishList: makeEnglishList

Description

Print a text for English prosa

Usage

makeEnglishList(v, sep = ", ", lastsep = ", and ", onlysep = " and ")

Value

character with plain text English prosa version

Arguments

v

vector

sep

character. spearates all but last entries of v [", "]

lastsep

character. spearates the last entries of v [", and "]

onlysep

character. spearates the two entries of v if length(v) == 2 [" and "]

Author

Andreas Leha

Details

Pastes a vector and adds comma and "and" to the correct places

Examples

Run this code
## defaut separators
makeEnglishList(c("foo", "bar", "baz"))
makeEnglishList(c("foo", "bar"))
makeEnglishList(c("foo"))

## without the 'Oxford comma'
makeEnglishList(c("foo", "bar", "baz"), lastsep = " and ")

## an 'or' list
makeEnglishList(c("foo", "bar", "baz"), lastsep = ", or ")

Run the code above in your browser using DataLab