Re: [Rd] Unexpected behavior with \r in Rgui 2.12.0

From: Russell Pierce <rpier001_at_ucr.edu>
Date: Thu, 25 Nov 2010 07:49:56 -0800

Prof. Ripley & Joris,

I concur with Joris, the behavior persists in R version 2.12.0 Patched (2010-11-24 r53655) and under Windows XP. The current development build for Windows did not have an RGui at the time I wrote this.

I did not realize that the functionality of "\r" to return to the beginning of the line in Windows was undocumented/unsupported. ?Quotes lists \r as carriage return without any warning that it is unsupported in RGui, perhaps a notice should be put in?

Since "\r" is not supported, I would like to express a desire that it at least do something predictable. Certainly, it seems doubtful that these "strange characters" (with the copying characteristics described) is what a user expects. If "\r" is not usable under RGui perhaps it would be better to ignore it entirely than to parse it and return the odd output that I am seeing?

In the RGui for Windows prior to this version "\r" returned to the beginning of the line without deleting the already written content.  Thus cat(70,"\r") and cat("\r",70) only differed in terms of where the cursor was left.

I started using "\r" because I had seen it in the code for txtProgressBar.  The help for txtProgressBar does note that it "uses \r to return to the left margin the interpretation of carriage return is up to the terminal or console in which *R* is running". For Jorris' reference, in a windows environment there are several methods to produce keep track of progress: tcltk::tkProgressBar, utils::txtProgressBar , and utils::winProgressBar.  None of them are as "user friendly" as cat and "\r" because you have to create the progress bar, increment it, then destroy it. If you want to output debugging information as well as increment a counter you need to tweak the title attribute as you go.

Best,

Russell S. Pierce

        [[alternative HTML version deleted]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 25 Nov 2010 - 17:15:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 25 Nov 2010 - 18:20:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive