grapes-p-grapes: Binary operator versions of paste and paste0

%p%R Documentation

Binary operator versions of paste and paste0

Description

Like most operators, can split across lines with operator at front of second line only if inside parenthesis. Unlike most operators, this is pretty likely to happen. See Examples.

Usage

x %p% y

x %pp% y

Arguments

x

The first object to paste

y

The second object to paste

Value

Returns the result of pasting the two objects together:

    x %p% y == paste0(x, y)
    x %pp% y == paste(x, y)

Examples

"Hello, " %p% "world!" == "Hello, world!"
"Hello," %pp% "world!" == "Hello, world!"
name <- "Amy"
"Hello," %pp% name %p% "!" == "Hello, Amy!"
"Hello," %pp%
   "world!" == "Hello, world!"
("Hello,"
    %pp% "world!") == "Hello, world!"
# "Hello,"
#    %pp% "world!" == "Hello, world!"
# Error: unexpected SPECIAL in "     %pp%"


jefferys/JefferysRUtils documentation built on Jan. 12, 2024, 9:18 p.m.