showing a status message in R

前端 未结 4 612
清歌不尽
清歌不尽 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:16

    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()
    }
    

提交回复
热议问题