Concatenate Two Strings in R programming – paste() method
paste()
method in R programming is used to concatenate the two string values by separating with delimiters.
Syntax:
paste(string1, string2, sep=)
Return: Returns the concatenate string.
Example 1:
# R program to concatenate two strings # Given Strings string1 < - "Beginner" string2 < - "Beginner" # Using paste() method answer < - paste(string1, string2, sep = " For " ) print (answer) |
Output:
[1] "Beginner For Beginner"
Example 2:
# R program to concatenate two strings # Given Strings string1 < - "I Love" string2 < - "R programming" # Using paste() method answer < - paste(string1, string2, sep = " " ) print (answer) |
Output:
[1] "I Love R programming"