输出多行文字

时间:2014-12-07 21:11:19

标签: r string concatenation

我有两个数字列表,我希望以闪亮的文本输出,但我输出多行很困难。说两个列表是:

violations1 <- c(1,2,3,5)
violations2 <- c(66,354,78)

对于输出我希望看到:

Violations of Type 1: 1, 2, 3, 4, 5
Violations of Type 2: 66, 354, 78

但是当我使用

paste("Violations of Type 1:", violations1, "Violations of Type 2:", violations2)

我得到了

[1] "Violations of Type 1: 1 Violations of Type 2: 66" 
[2] "Violations of Type 1: 2 Violations of Type 2: 354"
[3] "Violations of Type 1: 3 Violations of Type 2: 78" 
[4] "Violations of Type 1: 5 Violations of Type 2: 66" 

1 个答案:

答案 0 :(得分:4)

使用collapse的{​​{1}}选项:

paste