Overwrite current output in the R console

后端 未结 5 898
醉梦人生
醉梦人生 2021-01-01 18:43

I have been playing around with the R function txtProgressBar(). How can I hijack the function\'s ability to overwrite the current output in the console?

i.e. the p

5条回答
  •  别那么骄傲
    2021-01-01 19:33

    Instead of "\b\b\b\b" you can just use "\r" to go to the beginning of the line and overwrite everything on the line (make sure to still use cat and don't put in a line feed).

    Though if you want to display progress it might be better to use winProgressBar (windows only) or tkProgressBar (tcltk package, all platforms) which can be updated with a label in addition to the progress bar.

    On windows you can also use the setWindowTitle or setStatusBar functions to put that type of information into the top or bottom of the larger window.

提交回复
热议问题