I'm using sink() for logging purposes for running R-Scripts, which works fine.
*R> sink(file = paste(Log_Path, FileName), append = TRUE, type = c("output"), split = TRUE)*
I'm now doing performance tests and needing to find out how long certain parts of the R-Script runs, without adding tons of print statements.
This solution works, via in RGui Interface:
R> updatePrompt <- function(...) {options(prompt=paste(Sys.time(),"> ")); return(TRUE)}
R> addTaskCallback(updatePrompt)
However, The time prompts doesn't propagate back into the Console stream of sink() when running in the R-Server.
Suggestions?
I've explored txtStart , but not sure if that's what I need. Is there a different package or a option to set to set the timestamp in the prompt in the sink() console output?
Thanks for any help...
The prompt is not part of
stdout
, which is why it doesn't make it to the sink. Why don't you just print from your callback? For example:Note this times the time between statements completing, so if you're just waiting around the console doing nothing that will be part of the time as well.