我正在寻找将字符串列表粘贴在一起以进入 SQL 语句的最佳方式...我在使用分隔栏时遇到问题 | 当我不希望它在开始时打印:
foo = "blah"
paste_all_together = NULL
for (n in 1:4) {
paste_together = paste(foo ,sep = "")
paste_all_together = paste(paste_all_together, paste_together, sep = "|")
}
> paste_all_together
[1] "|blah|blah|blah|blah"
我只想让它打印出“blah|blah|blah|blah”。我需要一个嵌套循环,还是 R 中有更好的迭代器来执行此操作?或者也许是输入 SQL 语句的更好方法?