Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 R 编程语言,并且我有一个程序可以交付给一些客户。
我目前使用该功能sink()将一些输入保存到程序并测量时间性能,但如果出现错误,我也想将其保存到文件中。有人知道这样做的好方法吗?
sink()
谢谢你的时间。
看看sink()手册,它有一个message选项:
message
## capture all the output to a file. zz <- file("all.Rout", open = "wt") sink(zz) sink(zz, type = "message") try(log("a")) ## back to the console sink(type = "message") sink() try(log("a"))