%p% {common} | R Documentation |
An infix operator for paste0()
Description
This function provides an infix operator for the
paste0
function to concatenate strings. The operator
will concatenate a vector of one or more values. The functionality
is identical to paste0()
, but more convenient to use in some
situations.
Usage
x %p% y
Arguments
x |
A value for the left side of the paste infix operator. |
y |
A value for the right side of the paste infix operator. |
Value
The concatenated or pasted value. No spaces will be inserted in between the values to paste. If a vector of values is supplied, a vector of pasted values will be returned.
Examples
# Paste together two strings
str <- "Hello" %p% "World"
str
# [1] "HelloWorld"
# Paste together number and string
str <- 100 %p% " Kittens"
str
# [1] "100 Kittens"
# Paste together two vectors
v1 <- c("A", "B", "C")
v2 <- c(1, 2, 3)
str <- v1 %p% v2
str
# [1] "A1" "B2" "C3"
[Package common version 1.1.3 Index]