Re: [Rd] Strange behavior when using progress bar (Fwd: Re: [R] The code itself disappears after starting to execute the for loop)
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 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) } iter = 0 while (TRUE) {testit(style = 3); iter = iter + 1; print(paste("done", iter))} 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. 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 On 11/23/2016 5:22 PM, Maram SAlem wrote: Thanks a lot Bert , will check out your suggestions. I've unchecked the buffer output option in GUI but still have the same problem. Thanks for your time and concern. Maram Salem Sent from my iPhone On Nov 23, 2016, at 5:55 PM, Bert Gunter wrote: In addition to Jim's comments, which you have not yet satisfactorily addressed (buffering in GUI??), 1. Show your code! 2. Show ouput of sessionInfo() 3. Upgrade to the latest R version maybe 4. Perhaps write to package maintainer (see ?maintainer) if nothing or no one helps. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Nov 22, 2016 at 10:05 AM, Maram SAlem wrote: Thanks for helping Jim. I'm actually using the pbapply function together with the print function within a loop. In earlier versions, the progress bar and the output of the print function used to appear after each iteration of the loop. But with the 3.3.1. Version nothing appears, instead the console turns white and thecursor turns blue ( busy) and I know nothing about the progress of the running code. I just want to see the bar and the output of the print function as I used to, any help? Thanks in advance. Maram Salem Sent from my iPhone On Nov 3, 2016, at 8:30 PM, jim holtman wrote: A little more information would help. How exactly are out creating the output to the console? Are you using 'print', 'cat' or something else? Do you have buffered output checked on the GUI (you probably don't want it checked or you output will be delayed till the buffer is full -- this mightbe the cause of your problem. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Thu, Nov 3, 2016 at 1:55 PM, Maram SAlem wrote: Hi all, I've a question concerning the R 3.3.1 version. I have a long code that I used to run on versions earlier to the 3.3.1 version, and when I copied the code to the R console, I can still see the code while the loop is executing , along with the output printed after each iteration of the loop. Now, on the 3.3.1 version, after I copy the code to the console, it disappears and I only see the printed output of only one iteration at a time, that is, after the first iteration the printed output disappears ( thoughit's only 6 lines, just giving me some guidance, not a long output). This is causing me some problems, so I don't know if there is a general option for R that enables me to still see the code and the output of allthe iterations till the loop is over, as was the case with earlier R versions. I didn't include the code as it's a long one. Thanks a lot in advance, Maram Sent from my iPhone __ r-h...@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-gui
Re: [Rd] Strange behavior when using progress bar (Fwd: Re: [R] The code itself disappears after starting to execute the for loop)
> Jon Skoien > 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.sko...@jrc.ec.europa.eu > Tel: +39 0332 789205 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Strange behavior when using progress bar (Fwd: Re: [R] The code itself disappears after starting to execute the for loop)
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" machinelogin 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-boun...@r-project.org] On Behalf Of Martin > Maechler > Sent: December 7, 2016 5:58 AM > To: Jon Skoien > Cc: r-devel@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 > > 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.sko...@jrc.ec.europa.eu > > Tel: +39 0332 789205 > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Strange behavior when using progress bar (Fwd: Re: [R] The code itself disappears after starting to execute the for loop)
On 12/7/2016 11:58 AM, Martin Maechler wrote: Jon Skoien on Wed, 7 Dec 2016 11:04:04 +0100 writes: >> 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 ? Yes, I should have clarified, several versions of R, all running on the same Windows 8.1 computer. Jon >> >> 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.sko...@jrc.ec.europa.eu > Tel: +39 0332 789205 -- 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.sko...@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. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel