Skip to content
Back to formatted view

Raw Message

Message-ID: <1302333993025-3438040.post@n4.nabble.com>
Date: 2011-04-09T07:26:33Z
From: Berend Hasselman
Subject: A question about "txtProgressBar" function
In-Reply-To: <8360A74801605D4487C1D39EF1FDE13502B5A5C2@EXCHANGEVS-03.ad.wsu.edu>

Li, Yunfei wrote:
> 
> Hi,
> 
> I tried to add a progress bar to my script, but it seems the
> "txtProgressBar" function will wipe out what I want to print before it(for
> example - the "Hello" in following script), and the parameters "title" and
> "label" do not work either. How can I put a title for the progress bar? or
> is there any other better function I can use?
> 
> testit <- function(total =20)
> {
> cat("Hello\n")	
> 
> # create progress bar
> pb <- txtProgressBar(min = 0, max = total, style =
> 3,title="ProgressBar1",label="ProgressBar2")
> for(i in 1:total){
>    Sys.sleep(0.1)
>    # update progress bar
>    setTxtProgressBar(pb, i)
> }
> close(pb)
> }
> testit()
> 

Are running your script in Mac OS X or Windows GUI?

?flush.console

Replace cat(...) with  cat("Hello\n"); flush.console()

Berend


--
View this message in context: http://r.789695.n4.nabble.com/A-question-about-txtProgressBar-function-tp3437902p3438040.html
Sent from the R help mailing list archive at Nabble.com.