R paste0() function is used to concatenate vectors after converting them to character vectors without a separator.
Syntax
paste0(…, collapse = NULL)
Parameters
- …: It is one or more R objects to be converted to character vectors.
- collapse: It is an optional character string to separate the results.
Visual Representation
Example 1: How to Use paste0() function
paste0("Data", "Matics")
paste0(letters[18:22])
Output
[1] "DataMatics"
[1] "r" "s" "t" "u" "v"
Example 2: Passing ‘collapse’ argument
paste0("Data", collapse = " ")
paste0("Dog", collapse = "/")
paste0(letters[18:22], collapse = "*")
paste0("K", 1:7)
Output
[1] "Data"
[1] "Dog"
[1] "r*s*t*u*v"
[1] "K1" "K2" "K3" "K4" "K5" "K6" "K7"
Difference between paste() and paste0() function
The main difference between the paste() and paste0() functions is that the paste() function uses a separator, whereas the paste0() function does not use a separator.
st <- paste("Eleven", "Mike", "Dustin", sep = "")
st
# Default value of sep with paste function
st1 <- paste0("Eleven", "Mike", "Dustin")
st1
Output
[1] "ElevenMikeDustin"
[1] "ElevenMikeDustin"
The paste() and paste0() functions combine several inputs into a character string.
The paste0() is faster than paste() if our objective is to concatenate strings without spaces because we don’t have to specify the argument sep.

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.