考虑以下:
a = 1:10
paste("The list is:", a)
结果将是:
[1] "The list is: 1" "The list is: 2" "The list is: 3" "The list is: 4"
[5] "The list is: 5" "The list is: 6" "The list is: 7" "The list is: 8"
[9] "The list is: 9" "The list is: 10"
我已经通过以下方式解决了它:
paste("The list is:", paste(a, collapse=", "))
# "The list is: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10"
有没有更好的主意?