showing a status message in R

前端 未结 4 604
清歌不尽
清歌不尽 2020-12-08 03:00

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

4条回答
  •  天命终不由人
    2020-12-08 03:13

    There may be more elegant ways to do this, but this could do it:

    test.message <- function() {
      for (i in 1:9){
        cat(i)
        Sys.sleep(1)
        cat("\b")
      }
    
    }
    

    If you're automatically generating your message, you'll need to calculate how many \b characters to output to back up the correct amount, but that's pretty straightforward.

提交回复
热议问题