[Rd] Strange behavior when using progress bar (Fwd: Re: [R] The code itself disappears after starting to execute the for loop)

Fox, John jfox at mcmaster.ca
Wed Dec 7 14:59:05 CET 2016


Dear Martin and Jon,

I can reproduce this problem in the Windows GUI, where I observed it using Jon's program after 75 iterations. I didn't observe the problem in a Windows terminal or under RStudio, letting the program run for more than 200 iterations in each case.

My system and session info:

------------- snip ---------

> Sys.info()
         sysname          release          version         nodename 
       "Windows"         "10 x64"    "build 14393" "JOHN-CARBON-X1" 
         machine            login             user   effective_user 
        "x86-64"       "John Fox"       "John Fox"       "John Fox" 

> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 14393)

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252   
[3] LC_MONETARY=English_Canada.1252 LC_NUMERIC=C                   
[5] LC_TIME=English_Canada.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

------------- snip ---------

I hope this helps,
 John

-----------------------------
John Fox, Professor
McMaster University
Hamilton, Ontario
Canada L8S 4M4
Web: socserv.mcmaster.ca/jfox


> -----Original Message-----
> From: R-devel [mailto:r-devel-bounces at r-project.org] On Behalf Of Martin
> Maechler
> Sent: December 7, 2016 5:58 AM
> To: Jon Skoien <jon.skoien at jrc.ec.europa.eu>
> Cc: r-devel at r-project.org
> Subject: Re: [Rd] Strange behavior when using progress bar (Fwd: Re: [R] The
> code itself disappears after starting to execute the for loop)
> 
> >>>>> Jon Skoien <jon.skoien at jrc.ec.europa.eu>
> >>>>>     on Wed, 7 Dec 2016 11:04:04 +0100 writes:
> 
>     > I would like to ask once more if this is reproducible also for others?
>     > If yes, should I submit it as a bug-report?
> 
>     > Best,
>     > Jon
> 
> Please  Windows users .. this is possibly only for you!
> 
> Note that I do *not* see problems on Linux (in ESS; did not try RStudio).
> 
> Please also indicate in which form you are running R.
> Here it does depend if this is inside RStudio, ESS, the "Windows GUI", the
> "Windows terminal", ...
> 
> Martin Maechler,
> ETH Zurich
> 
> 
>     > On 11/28/2016 11:26 AM, Jon Skoien wrote:
>     >> I first answered to the email below in r-help, but as I did not see
>     >> any response, and it looks like a bug/unwanted behavior, I am also
>     >> posting here. I have observed this in RGui, whereas it seems not to
>     >> happen in RStudio.
>     >>
>     >> Similar to OP, I sometimes have a problem with functions using the
>     >> progress bar. Frequently, the console is cleared after x iterations
>     >> when the progress bar is called in a function which is wrapped in a
>     >> loop. In the example below, this happened for me every ~44th
>     >> iteration. Interestingly, it seems that reduction of the sleep times
>     >> in this function increases the number of iterations before clearing.
>     >> In my real application, where the progress bar is used in a much
>     >> slower function, the console is cleared every 2-3 iteration, which
>     >> means that I cannot scroll back to check the output.
> 
>  testit <- function(x = sort(runif(20)), ...) {
>    pb <- txtProgressBar(...)
>    for(i in c(0, x, 1)) {Sys.sleep(0.2); setTxtProgressBar(pb, i)}
>    Sys.sleep(1)
>    close(pb)
>  }
> 
>  it <- 0
>  while (TRUE) {testit(style = 3); it <- it + 1; print(paste("done", it))}
> 
>     >> Is this only a problem for a few, or is it reproducible? Any hints to
>     >> what the problem could be, or if it can be fixed? I have seen this in
>     >> some versions of R, and could also reproduce in 3.3.2.
> 
> "some versions of R" ... all on Windows ?
> 
>     >>
>     >> Best wishes,
>     >> Jon
>     >>
>     >> R version 3.3.2 (2016-10-31)
>     >> Platform: x86_64-w64-mingw32/x64 (64-bit)
>     >> Running under: Windows 8.1 x64 (build 9600)
>     >>
>     >> locale:
>     >> [1] LC_COLLATE=English_United States.1252
>     >> [2] LC_CTYPE=English_United States.1252
>     >> [3] LC_MONETARY=English_United States.1252
>     >> [4] LC_NUMERIC=C
>     >> [5] LC_TIME=English_United States.1252
>     >>
>     >> attached base packages:
>     >> [1] stats     graphics  grDevices utils     datasets  methods base
> 
> [.....................]
> 
>     > Jon Olav Skøien
>     > Joint Research Centre - European Commission
>     > Institute for Space, Security & Migration
>     > Disaster Risk Management Unit
> 
>     > Via E. Fermi 2749, TP 122,  I-21027 Ispra (VA), ITALY
> 
>     > jon.skoien at jrc.ec.europa.eu
>     > Tel:  +39 0332 789205
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list