Hi there,

I am using R 2.15.2 under Win7 64. I hope to display progress bar when I am running a loop. After the loop exit, the cursor is at the right margin of the window. How can I make it to the left margin?

Here is the minimal example code.

combn.bar <- function(n, m) {
    n <- choose(n, m)
    pb <- txtProgressBar(1,n,style = 3)
    for (i in 1:n) {
        Sys.sleep(0.1)
        setTxtProgressBar(pb, i)
    }
    close(pb)
}

combn.bar(6,3)

I try to move the cursor to the left margin using cat("\r"). However, after that, I can not move the cursor to left if I try to edit a history command.

It seems a problem that only related with Rgui. I try the above example in Rterm, it works well.

Any help will be really appreciated.

Regards,
Jinsong

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to