Learn R Programming

verbaliseR (version 0.1)

listify: Turn vectors into lists with any specified linking word

Description

Turn vectors into lists with any specified linking word

Usage

listify(items, linking_word = "and", oxford_comma = FALSE)

Value

A string in the form of a list (e.g. "a, b and c")

Arguments

items

A vector of items to turn into a list phrase (e.g. c("a", "b", "c")).

linking_word

Defaults to "and". Can be anything.

oxford_comma

logical. Defaults to FALSE. If TRUE, an oxford comma is added (e.g. "a, b, and c").

Examples

Run this code
listify(c("a", "b", "c"), "or")

Run the code above in your browser using DataLab