From Greg.Snow at imail.org  Tue Mar 15 20:18:42 2011
From: Greg.Snow at imail.org (Greg Snow)
Date: Tue, 15 Mar 2011 13:18:42 -0600
Subject: [Rd] Feature request: txtProgressBar with ability to write to
 arbitrary stream
In-Reply-To: <4D7F4161.2070909@unimedizin-mainz.de>
References: <4D7F4161.2070909@unimedizin-mainz.de>
Message-ID: <B37C0A15B8FB3C468B5BC7EBC7DA14CC63453A3337@LP-EXMBVS10.CO.IHC.COM>

You could use winProgressBar (windows only) or TkProgressBar (tcltk package required) instead, then nothing is output to the console/standard out but you still have a visual of your progress.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-
> project.org] On Behalf Of Andreas Borg
> Sent: Tuesday, March 15, 2011 4:37 AM
> To: R-devel at r-project.org
> Subject: [Rd] Feature request: txtProgressBar with ability to write to
> arbitrary stream
> 
> Hi all,
> 
> I use txtProgressBar to monitor progress of large computations. What I
> miss is the ability to redirect the progress bar to a stream other than
> stdout, specifically to the message stream. This would be useful for
> running Sweave scripts: When redirected to stderr, the bar could be
> visible even though console output is diverted to the output file (and
> there would be no cluttering of the generated latex).
> 
> I'd suggest the following changes to txtProgressBar:
> - a new argument 'file' (compare to 'cat') which defaults to stderr()
> (there might be reasons to use stdout(), but I believe a progress bar
> is
> mostly intended as a diagnostic tool and not for console output, which
> is printed or saved in some cases).
> - the calls to 'cat' that update the progress bar get 'file = file' as
> additional argument so that output is redirected as desired.
> 
> In case anyone from the core team is willing to incorparate this idea,
> I
> attached the patch file for the necessary changes below.
> 
> Best regards,
> 
> Andreas
> 
> 3c3
> <              width = NA, title, label, style = 1)
> ---
>  >              width = NA, title, label, style = 1, file=stderr())
> 23c23
> <             cat(paste(rep.int(char, nb-.nb), collapse=""))
> ---
>  >             cat(paste(rep.int(char, nb-.nb), collapse=""), file =
> file)
> 27c27
> <                 "\r", paste(rep.int(char, nb), collapse=""), sep =
> "")
> ---
>  >                 "\r", paste(rep.int(char, nb), collapse=""), sep =
> "", file = file)
> 38c38
> <             cat("\r", paste(rep.int(char, nb), collapse=""), sep =
> "")
> ---
>  >             cat("\r", paste(rep.int(char, nb), collapse=""), sep =
> "", file = file)
> 42c42
> <                 "\r", paste(rep.int(char, nb), collapse=""), sep =
> "")
> ---
>  >                 "\r", paste(rep.int(char, nb), collapse=""), sep =
> "", file = file)
> 54c54
> <         cat(paste(c("\r  |", rep.int(" ", nw*width+6)), collapse=""))
> ---
>  >         cat(paste(c("\r  |", rep.int(" ", nw*width+6)),
> collapse=""),
> file = file)
> 59c59
> <                     ), collapse=""))
> ---
>  >                     ), collapse=""), file = file)
> 68c68
> <             cat("\n")
> ---
>  >             cat("\n", file = file)
> 
> --
> Andreas Borg
> Medizinische Informatik
> 
> UNIVERSIT?TSMEDIZIN
> der Johannes Gutenberg-Universit?t
> Institut f?r Medizinische Biometrie, Epidemiologie und Informatik
> Obere Zahlbacher Stra?e 69, 55131 Mainz
> www.imbei.uni-mainz.de
> 
> Telefon +49 (0) 6131 175062
> E-Mail: borg at imbei.uni-mainz.de
> 
> Diese E-Mail enth?lt vertrauliche und/oder rechtlich gesch?tzte
> Informationen. Wenn Sie nicht der
> richtige Adressat sind oder diese E-Mail irrt?mlich erhalten haben,
> informieren Sie bitte sofort den
> Absender und l?schen Sie diese Mail. Das unerlaubte Kopieren sowie die
> unbefugte Weitergabe
> dieser Mail und der darin enthaltenen Informationen ist nicht
> gestattet.
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Feature request: txtProgressBar with ability to write to arbitrary stream
Greg Snow