Description Usage Arguments Details Value Author(s) See Also Examples
Creating progress bar and setting options.
1 2 3 4 5 6 |
... |
Arguments in |
pb |
A progress bar object created by |
min, max |
Finite numeric values for the extremes of the progress bar.
Must have |
value |
New value for the progress bar. |
pboptions
is a convenient way of handling options
related to progress bar.
Other functions can be used for conveniently adding progress
bar to for
-like loops
(see Examples).
When parameters are set by pboptions
, their former values are
returned in an invisible named list. Such a list can be passed as an
argument to pboptions
to restore the parameter values.
Tags are the following:
type |
Type of the progress bar: text ( |
char |
The character (or character string) to form the progress bar.
Default value is |
txt.width |
The width of the text based progress bar, as a multiple
of the width of |
gui.width |
The width of the GUI based progress bar in pixels:
the dialogue box will be 40 pixels wider (plus frame).
Default value is |
style |
The style of the bar, see
|
initial |
Initial value for the progress bar. Default value is
|
title |
Character string giving the window title
on the GUI dialogue box. Default value is |
label |
Character string giving the window label
on the GUI dialogue box. Default value is |
For startpb
a progress bar object.
For getpb
and setpb
, a length-one numeric vector giving
the previous value (invisibly for setpb
).
The return value is NULL
if the progress bar is turned off by
getOption("pbapply.pb")
("none"
or NULL
value).
dopb
returns a logical value if progress bar is to be shown
based on the option getOption("pbapply.pb")
.
It is FALSE
if the type of progress bar is "none"
or
NULL
.
For closepb
closes the connection for the progress bar.
Peter Solymos <solymos@ualberta.ca>
Progress bars used in the functions:
txtProgressBar
,
tkProgressBar
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ## for loop
fun1 <- function() {
pb <- startpb(0, 10)
for (i in 1:10) {
Sys.sleep(0.15)
setpb(pb, i)
}
closepb(pb)
}
## while loop
fun2 <- function() {
pb <- startpb(0, 10-1)
i <- 1
while (i < 10) {
Sys.sleep(0.15)
setpb(pb, i)
i <- i + 1
}
closepb(pb)
}
## using original settings
fun1()
## resetting pboptions
opb <- pboptions(style=1, char=">")
## check new settings
getOption("pboptions")
## running again with new settings
fun2()
## resetting original
pboptions(opb)
## check reset
getOption("pboptions")
fun1()
|
$type
[1] "none"
$char
[1] ">"
$txt.width
[1] 50
$gui.width
[1] 300
$style
[1] 1
$initial
[1] 0
$title
[1] "R progress bar"
$label
[1] ""
$nout
[1] 100
$min_time
[1] 0
$type
[1] "none"
$char
[1] "+"
$txt.width
[1] 50
$gui.width
[1] 300
$style
[1] 3
$initial
[1] 0
$title
[1] "R progress bar"
$label
[1] ""
$nout
[1] 100
$min_time
[1] 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.