有没有人知道如何打印一个语句,并让它后跟一个向量的所有值,而不是多次打印语句,每次都后跟向量中的单个值。
我希望它打印一次语句,然后打印向量的所有元素。这是返回一个例子:
print(sprintf('The times of these 20 trades were %s' , as.POSIXct(timestore)))
The times of these 20 trades were 2023-06-10 19:30:56.377"
[2] "The times of these 20 trades were 2023-06-10 19:30:56.377"
[3] "The times of these 20 trades were 2023-06-10 19:30:56.377"
[4] "The times of these 20 trades were 2023-06-10 19:30:56.377"
[5] "The times of these 20 trades were 2023-06-10 19:30:56.377"
[6] "The times of these 20 trades were 2023-06-10 19:30:56.377
我希望它打印一次语句,然后打印向量的所有元素。
1条答案
按热度按时间nszi6y051#
我们可以用
paste(sep = ",")
或toString()
连接这些值:我们也可以用数字方式声明交易次数。
glue::glue
用于动态生成字符串:但是如果我们只想打印几行,一行用于语句,一行用于每个时间戳,那么
print(c(statement, timestore))
就可以了。