当使用打印功能打印到屏幕时,我希望一行出现在一行上,下一行出现在第二行。
这一行
print(
paste(
"hey I want this to be line one", "and this to be line two", "would be great if you could help"
)
)
我想要打印
[1]“嘿,我希望这是第一行
[2]如果你能提供帮助,这就是第二行会很棒
答案 0 :(得分:7)
我假设您的示例输出实际上应该是三行而不是两行...您应该使用cat
而不是print
,并将sep="\n"
添加到paste
语句:
cat(paste("hey I want this to be line one",
"and this to be line two",
"would be great if you could help" ,sep="\n"))
输出:
hey I want this to be line one
and this to be line two
would be great if you could help