功能修改字符串

use*_*629 2 string r character

我需要一个将输入作为字符串(BLANK)并打印出以下内容的函数:

"Hello BLANK World"
Run Code Online (Sandbox Code Playgroud)

即,世界("七")打印出来 "Hello seven World"

我对如何使用R中的字符串感到困惑.

Mat*_*erg 5

你想要这个功能 paste

world <- function(x) paste("Hello", x, "World")
Run Code Online (Sandbox Code Playgroud)


Tyl*_*ker 5

要么...

 x <- "seven"
 sprintf("Hello %s World", x)
Run Code Online (Sandbox Code Playgroud)

换句话说,不需要world功能就是sprintf这样.