I think you meant

.Platform$OS.type == "windows"

Wouldn't be useful to add an "eol" element to the .Platform list storing the
os-specific eol character as was done with the "file.sep" character.

-Christos Hatzis  

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gabor Grothendieck
Sent: Friday, March 17, 2006 10:00 AM
To: [EMAIL PROTECTED]
Cc: [email protected]
Subject: Re: [R] cat(), Rgui, and support for carriage return \r...

You could try this:

eol <- if (Platform$OS.type == "windows") "\n" else "\r"

and then use the eol variable in your cat statement.

On 3/17/06, Jeffrey Racine <[EMAIL PROTECTED]> 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 as
>
> 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 on?
>
> Many thanks for any/all suggestions.
>
> -- Jeff
>
> --
> Professor J. S. Racine         Phone:  (905) 525 9140 x 23825
> Department of Economics        FAX:    (905) 521-8232
> McMaster University            e-mail: [EMAIL PROTECTED]
> 1280 Main St. W.,Hamilton,     URL:
> http://www.economics.mcmaster.ca/racine/
> Ontario, Canada. L8S 4M4
>
> `The generation of random numbers is too important to be left to
>
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to