使用函数时如何插入新行paste() http://stat.ethz.ch/R-manual/R-patched/library/base/html/paste.html或者 R 中连接字符串的任何函数?
关于这个主题有很多网页,但没有一个给出明确的答案或给出有效的解决方案。我确切地说我不想使用该功能cat http://stat.ethz.ch/R-manual/R-patched/library/base/html/cat.html,我需要处理字符串。
这是我所有的尝试(来自不同论坛的所有建议),它们都失败了......
第一次尝试:粘贴()
msg <- "==================================================\n"
msg <- paste(msg, "Var:")
print(msg)
Output:
[1] "================================================ ====\n 变量:"
第二次尝试:paste0()
msg <- "==================================================\n"
msg <- paste0(msg, "Var:")
print(msg)
Output:
[1] "================================================ ====\n变量:"
第三次尝试:九月
msg <- "=================================================="
msg <- paste(msg, "Var:", sep = "\n")
print(msg)
Output:
[1] "================================================ ====\n变量:"
第四次尝试:sprintf
msg <- sprintf("==================================================\n")
msg <- paste(msg, "Var:")
print(msg)
Output:
[1] "================================================ ====\n变量:"
我相信我已经尝试了一切我能做的...如果你有想法?!