From jon.skoien at jrc.ec.europa.eu  Mon Dec 12 17:31:06 2016
From: jon.skoien at jrc.ec.europa.eu (Jon Skoien)
Date: Mon, 12 Dec 2016 17:31:06 +0100
Subject: [Rd] Strange behavior when using progress bar (Fwd: Re: [R] The
 code itself disappears after starting to execute the for loop)
In-Reply-To: <ACD1644AA6C67E4FBD0C350625508EC8365A6B4A@FHSDB2D11-2.csu.mcmaster.ca>
References: <54b8d998-9299-4034-be0a-9c9ad7169974@jrc.ec.europa.eu>
	<fdd2811e-60af-e322-4e33-0c1ad5eab0ee@jrc.ec.europa.eu>
	<ec37a17e-b2ee-b1df-2490-6006f49b886c@jrc.ec.europa.eu>
	<22599.60218.182964.817869@stat.math.ethz.ch>
	<ACD1644AA6C67E4FBD0C350625508EC8365A6B4A@FHSDB2D11-2.csu.mcmaster.ca>
Message-ID: <1a06d87d-9cc0-8f3d-21fc-5c4c7eb29c46@jrc.ec.europa.eu>

Thanks John,

As the problem can be reproduced, I would like to submit this as a bug 
report. But I think someone will have to add me to Bugzilla first.
Given the few responses, I am not expecting that this will get a high 
priority though...

Jon

On 12/7/2016 2:59 PM, Fox, John wrote:
> 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

-- 
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

Disclaimer: Views expressed in this email are those of the individual and do not necessarily represent official views of the European Commission.



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