%p% | R Documentation |
paste0()
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.
x %p% y
x |
A value for the left side of the paste infix operator. |
y |
A value for the right side of the paste infix operator. |
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.
# 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"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.