[R] cat(), Rgui, and support for carriage return \r...
murdoch at stats.uwo.ca
Fri Mar 17 20:39:36 CET 2006
On 3/17/2006 9:44 AM, Jeffrey Racine wrote:
> Hi, and thanks in advance for your time.
> Background - I am working on a package and wish to have a routine's
> progress reported. The routine can take some time, and I would like to
> inform the user about the routine's progress. I have scoured the
> archives but to no avail, so would like to solicit input from this list.
> I am successfully using
> cat("\rBootstrap replication ", i, " of ", boot.num,)
> flush.console() # To flush stdout on windows systems
> which works as expected on *NIX systems and using Rterm under windows.
> However, under Rgui the carriage return \r is ignored, and I certainly
> don't want to use the newline escape sequence \n. Under Rgui it appears
> Bootstrap replication 1 of 399Bootstrap replication 2 of 399Bootstrap...
> but I want it to function properly if at all possible.
> My question is simply whether there is a portable way to implement this
> so that it works regardless of the R platform the user may be working
> Many thanks for any/all suggestions.
This looks like it would be a useful addition to Rgui to support this.
The problem is that on Unix or Rterm, it isn't actually R that does
anything, it's the display that handles the CR with no LF. Rgui uses a
different mechanism for putting text on the screen, so this would have
to be implemented specially.
Just out of interest: does the Mac OS X gui handle this like the ascii
terminals or like Windows Rgui?
More information about the R-help