concatenate a string in R
Code snippet on how to concatenate a string in R
myString1 <- "Hello"
myString2 <- "World!"
paste(myString1, myString2)
This code creates two strings and stores them in the variables myString1
and myString2
. The paste()
function combines these two strings together, and they are then printed to the console. The paste()
function separated the two strings with a space, but you can use the sep
argument to specify what character you want to separate the strings with, such as a comma, dash, or any other character. The output of this code would be “Hello World!“.