0

I'm seeing behavior I don't expect with the cat commands and flush.console() in RGui 2.12.0 (but not Rterm) for Windows. I wanted to see whether it was a problem with my system (or a known behavior) before reporting it as a bug. Specifically I'm seeing strange UNICODE looking characters as it iterates through. Please forgive the use of the huge rnorm() I couldn't figure out how to slow execution in an established way.

for (i in 1:100) {cat(i,"\r");flush.console();rnorm(1000000)}

R version 2.12.0 (2010-10-15)
Platform: i386-pc-mingw32/i386 (32-bit)

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 
4
  • n <- 2.5; Sys.sleep(n) is a cheaper way to delay. The time argument is in seconds and can be fractional, eg Sys.sleep(0.1) would sleep for (approximately) 100 milliseconds. Commented Nov 7, 2010 at 22:34
  • Where do you see strange characters? Always in the same place? Or in different places each time you try this? Have you tried using \n instead of \r for end-of-line? Commented Nov 7, 2010 at 22:58
  • I use \r to update while I am in long loops to keep track of where I am and assure myself progress is being made (it is similar to how the base text progress bar works). I don't like using \n because it spams interesting stuff off my screen. Interestingly the error does not occur with \n. Commented Nov 8, 2010 at 1:17
  • The characters always show up where I'd expect the catted text to occur. Commented Nov 15, 2010 at 17:51

2 Answers 2

2

It worked as you would expect under R-2.10.0, which is the previous version of R installed in my seldom-used Windows machine. ;-)

I would say report it, but I would just send it to R-devel as "unexpected behavior" as you did here. Make sure to check against the latest daily build before reporting it, since it may have already been fixed.

Sign up to request clarification or add additional context in comments.

Comments

1

The problem was in the RGui and the devs claim it will be fixed in the next minor release of 2.12.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.