Simple question: is there a way how I can add a timestamp into the RStudio console? Instead of the console only showing this:
>"This is my code"
it would convert this (after executing) into
[HH:MM:SS]> "This is my code"
[1] "This is my code"
Simple question: is there a way how I can add a timestamp into the RStudio console? Instead of the console only showing this:
>"This is my code"
it would convert this (after executing) into
[HH:MM:SS]> "This is my code"
[1] "This is my code"
The simplest way is to use Sys.time()
this is my code
Sys.time()
In future RStudio releases it might be possible to assign shortcuts to user scripts.
Then you might be able to create a function that will execute code and always output whatever statistics you want by pressing ctrl+enter. RStudio Can't guess these stats for everyone, what if I want the end time as well as the start time? How about the execution time? RStudio and R are great but yea, sometimes we still have to do stuff ourselves like coding our own darned statistics.
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
You could try the taskCallbackManager - this gets evaluated every time a function is called:
new_prompt <- taskCallbackManager()
new_prompt$add(function(expr, value, ok, visible) {
options("prompt" = format(Sys.time(), "[%H:%M:%S]> "));
return(TRUE) },
name = "promptHandler")