I wonder if there is a way to display the current time in the R command line, like in MS DOS, we can use
Prompt $T $P$G
to include the time clock in every prompt line.
Something like
options(prompt=paste(format(Sys.time(), "%H:%M:%S"),"> "))
will do it, but then it is fixed at the time it was set. I'm not sure how to make it update automatically.
Best Answer
Chase points the right way as
options("prompt"=...)
can be used for this. But his solutions adds a constant time expression which is not what we want.The documentation for the function
taskCallbackManager
has the rest:We register a callback that gets evaluated after each command completes. That does the trick. More fancy documentation is in this document from the R developer site.