[Rd] Unexpected behavior with \r in Rgui 2.12.0

Joris Meys jorismeys at gmail.com
Thu Nov 25 14:51:46 CET 2010


I downloaded the latest patch today and the problem still persists.
AFAIK, "\r" can be useful to give a counter that stays in place, or is
there another way of doing that in a Windows environment?

Funny thing is : if you copy-paste the strange characters, you get the
correct counts, but you get the \n characters that seperate them as
well.

> for (i in 1:5) {cat(i,"\n\r");flush.console();Sys.sleep(.100)}

gives a series of funny characters. If you hover over them or select
them for copying, they change into other ones. If you copy-paste those
characters however, you get strangely enough:
> for (i in 1:5) {cat(i,"\n\r");flush.console();Sys.sleep(.100)}
1

2

3

4

5

>

which includes the \n character. I attached a screenshot of the signs
I have on my screen.

Cheers
Joris


On Thu, Nov 25, 2010 at 2:36 PM, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:
> First, I don't think  cat(70,"\r")  has ever been useful in Rgui.
> It outputs and then deletes a line: Rgui has never supported overwriting.  I
> think you really want cat('\r', i, sep="").
>
> Second, in some circumstances in 2.12.0 only, some storage was discarded too
> early and so random characters might appear.  This has now been fixed, so
> please try a recent R-patched.
>
> But the main problem was the expectation: there is nothing that I know of
> which says that '\r' works in the way it does in some (but not all) Unix
> terminals.
>
> On Sun, 7 Nov 2010, Russell Pierce wrote:
>
>> I am experiencing unexpected behavior with the command cat under
>> Window GUI builds of R version 2.12.0 (it does not seem to be an issue
>> in Rterm).  For example if I issue the command cat(70,"\r") I get back
>> text that looks like Asian characters.  If I highlight and copy that
>> text, it is the text I would regularly expect, e.g. the number 70 and
>> the prompt line.  Highlighting the text changes what is shown on the
>> screen, but the screen never displays the number 70.  This error is
>> not idiosyncratic to 70 but happens with a fairly wide range of
>> numbers.  Notably no error like this occurs when I use \n.  I use \r
>> for large simulation runs when I don't want my progress to spam the
>> display.
>>
>> e.g.
>> for (i in 1:1000) {cat(i,"\r");flush.console();Sys.sleep(.100)}
>>
>> sessionInfo() where I first saw the problem:
>> R version 2.12.0 (2010-10-15) on Windows Vista
>> 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
>>
>> Also experienced here:
>> R version 2.12.0 (2010-10-15) on Windows XP
>> R version 2.12.0 Patched (2010-11-04 r53530) on Windows Vista
>> R version 2.13.0 Under development (unstable) (2010-11-04 r53530) on
>> Windows Vista
>>
>> But not here:
>> Not under R version 2.10.1 (2009-12-14) on Windows XP
>>
>> If this is expected behavior would you please kindly explain it to me?
>> I am not a member of this list, so please address replies both to my
>> email address and (if appropriate) the list.
>>
>> Best,
>>
>> Russell Pierce
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
> --
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>



-- 
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

tel : +32 9 264 59 87
Joris.Meys at Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Rsymbols.png
Type: image/png
Size: 6984 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20101125/7628df26/attachment.png>


More information about the R-devel mailing list