%+% {infixit}R Documentation

Paste Infix Operator

Description

Many programming languages utilize + as a means of concatenating strings. In standard R, however, + will return an error when used with strings. ⁠%+%⁠ provides this ability for parsimonious string concatenation.

Usage

lhs %+% rhs

Arguments

lhs

The left-hand side.

rhs

The right-hand side.

Details

By default, it uses paste0 under the hood, but this can be shifted to paste by running options(infixit.paste = "paste0"). By default (as with paste), this will have the seperator be a single space (" ") between the pasted objects. This behavior can be changed with the infixit.paste_sep option. E.g., options(infixit.paste_sep = "|")

Value

A string pasting the rhs to the lhs.

Examples

{

b <- "An additional sentence."

"This is a sentence. " %+% b
}

[Package infixit version 0.3.1 Index]