【发布时间】:2019-12-06 17:24:41
【问题描述】:
这很简单。
v = c("var1", "var2", "var3")
for (i in v) {
function(data = df, ..., main = "here comes a text and \v")
}
问题是,我怎样才能确保 v 出现在那里?我知道 Swift 有这个 \() 命令,你可以在字符串中传递它。
编辑
paste解决了这个问题。
【问题讨论】:
这很简单。
v = c("var1", "var2", "var3")
for (i in v) {
function(data = df, ..., main = "here comes a text and \v")
}
问题是,我怎样才能确保 v 出现在那里?我知道 Swift 有这个 \() 命令,你可以在字符串中传递它。
编辑
paste解决了这个问题。
【问题讨论】:
你在找paste()吗?
v = c("var1", "var2", "var3")
for (i in v) {
function(data = df, ..., main = paste("here comes a text and",v))
}
这将使main 等于Here comes a text and var1、Here comes a text and var2 和here comes a text and var3。
【讨论】: