【发布时间】:2020-11-06 13:52:44
【问题描述】:
简单的问题:有没有办法在 RStudio 控制台中添加时间戳?而不是控制台只显示这个:
>"This is my code"
它将(在执行后)转换成
[HH:MM:SS]> "This is my code"
[1] "This is my code"
【问题讨论】:
简单的问题:有没有办法在 RStudio 控制台中添加时间戳?而不是控制台只显示这个:
>"This is my code"
它将(在执行后)转换成
[HH:MM:SS]> "This is my code"
[1] "This is my code"
【问题讨论】:
最简单的方法是使用Sys.time()
this is my code
Sys.time()
在未来的 RStudio 版本中,可能会assign shortcuts to user scripts.
然后您可能能够创建一个函数,该函数将执行代码并始终通过按ctrl+enter 输出您想要的任何统计信息。 RStudio 无法为每个人猜测这些统计信息,如果我想要结束时间和开始时间怎么办?执行时间如何? RStudio 和 R 很棒,但是是的,有时我们仍然需要自己做一些事情,比如编写我们自己该死的统计数据。
Kevin UsheySeptember 15, 2015 12:49 Hi Alain, Mapping keyboard shortcuts to user scripts is something we have in the pipeline, but we haven't yet completed that work. Stay tuned! Best, Kevin
【讨论】:
您可以尝试taskCallbackManager - 每次调用函数时都会对其进行评估:
new_prompt <- taskCallbackManager()
new_prompt$add(function(expr, value, ok, visible) {
options("prompt" = format(Sys.time(), "[%H:%M:%S]> "));
return(TRUE) },
name = "promptHandler")
【讨论】: