append_combn: Append a combination of head and tail elements to x

View source: R/append_combn.R

append_combnR Documentation

Append a combination of head and tail elements to x

Description

Create a combination of patterned outputs of x based on head and/or tail elements

Usage

append_combn(x, head = NULL, tail = NULL)

Arguments

x

A vector of values you wish to append to; will be coerced to character if not.

head

(optional) A vector of values you wish to append to the head of x.

tail

(optional) A vector of values you wish to append to the tail of x.

Value

A list of length x, with elements the length of the cartesian product of length(head) and length(tail).

Examples

x <- replicate(10, paste(sample(letters, 3), collapse = ""))
append_combn(x, head = ":", tail = "-")
append_combn(x, head = c(":", "|"), tail = "-")
append_combn(x, head = "_A_")
append_combn(x, head = paste0(LETTERS[1:10], "_"), tail = c("-", "_"))

slin30/wzMisc documentation built on Jan. 27, 2023, 1 a.m.