paste0() or paste()

paste() or paste0() are cancatenate vectors that are used inside of the theme function.
paste (…, sep = ” “, collapse = NULL, recycle0 = FALSE)
paste0(…, collapse = NULL, recycle0 = FALSE)


…:  one or more R objects, to be coerced to character vectors.
sep:  a character string to separate the terms.
collapse an optional character string to separate the results.


paste converts its arguments to character strings, and concatenates them (separating them by the string given by sep). If the arguments are vectors, they are concatenated term-by-term to give a character vector result.
If a value is specified for collapse, the values in the result are then concatenated into a single string, with the elements being separated by the value of collapse.


A character vector of the concatenated values.

See Also
as.character, substr, nchar, strsplit.

paste(1:12) # same as as.character(..)
paste(“A”, 1:6, sep = “”)
paste(“Today is”, date())

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top