In this tutorial you will learn about the R String Paste Function and its application with practical example.
R String Paste Function
In R, the paste() function is used for concatenating multiple strings in one string. The paste() function can combine any number of strings together.
paste(..., sep = " ", collapse = NULL)
Above is the general syntax of paste() function, here
…:- It represents arguments that needs to be concatenated.
sep:- It is a separator, which is used to combine arguments with. It is an optional parameter
collapse:- It is used to remove unwanted space between two string. It does not remove space between two words in a string.
a <- "Welocome"
b <- 'To'
c <- "W3Adda"
print(paste(a,b,c, sep = "-"))
print(paste(a,b,c, sep = "", collapse = ""))