📜  在 R 编程中连接两个字符串 - paste() 方法

📅  最后修改于: 2022-05-13 01:55:48.490000             🧑  作者: Mango

在 R 编程中连接两个字符串 - paste() 方法

R 编程中的paste()方法用于通过用分隔符分隔来连接两个字符串值。

示例 1:

# R program to concatenate two strings
  
# Given Strings
string1 <- "Geeks"
string2 <- "Geeks"
  
# Using paste() method
answer <- paste(string1, string2, sep=" For ")
  
print(answer)

输出:

[1] "Geeks For Geeks"

示例 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)

输出:

[1] "I Love R programming"