f_list {numform}R Documentation

Format List Series

Description

f_list - Format a vector of elements as a list series (e.g., c('A', 'B', 'C') becomes "A, B, and C").

f_list_amp - A ampersand wrapper for f_list with and = '&' set by default.

Usage

f_list(x, and = "and", oxford = TRUE, ...)

f_list_amp(x, and = "&", oxford = TRUE, ...)

ff_list(...)

Arguments

x

A vector of values to turn into a collapsed series.

and

The value to use for the 'and'. Commonly 'and' and '&' are used.

oxford

logical. If TRUE an oxford comma is used. If you use FALSE you are a monster.

...

ignored.

Value

Returns a string that is a list series.

Examples

f_list(1)
f_list(1:2)
f_list(1:3)
f_list(1:5)

x <- c("parents", "Lady Gaga",  "Humpty Dumpty")
## Three things you love
sprintf('I love my %s.', f_list(x))
## Your parents are lady Gaga & Humpty Dumpty?????
sprintf('I love my %s.', f_list(x, oxford = FALSE))

sprintf('I love my %s.', f_list(x, and = '&'))
sprintf('I love my %s.', f_list_amp(x))

[Package numform version 0.7.0 Index]