I'd like to write a function that presents to the user a status message that shows something like the time, the percent complete, and the current status of a process. I can handle assembling the message, but I'd like to do something other than just print to the console and have it scroll up, one message after the other. I'd really like the message to change without scrolling like message()
and without any graphics. Is this possible with R?
How about something like this?
for(i in 1:10) {
Sys.sleep(0.2)
# Dirk says using cat() like this is naughty ;-)
#cat(i,"\r")
# So you can use message() like this, thanks to Sharpie's
# comment to use appendLF=FALSE.
message(i,"\r",appendLF=FALSE)
flush.console()
}