showing a status message in R

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

    Here's some bling bling. From ?tcltk::tkProgressBar.

    pb <- tkProgressBar("test progress bar", "Some information in %",
            0, 100, 50)
    Sys.sleep(0.5)
    u <- c(0, sort(runif(20, 0 ,100)), 100)
    for(i in u) {
        Sys.sleep(0.1)
        info <- sprintf("%d%% done", round(i))
        setTkProgressBar(pb, i, sprintf("test (%s)", info), info)
    }
    Sys.sleep(5)
    close(pb)
    

    alt text

提交回复
热议问题