This function lets the user view a progressbar for a 'for' loop.
Usage
statusbar(
run = 1,
max.run = 100,
label = run,
msg = "",
type = Sys.getenv("LARES_STATUSBAR"),
start_time = NA,
multiples = 1,
alarm = FALSE
)
Arguments
- run
Iterator. for loop or an integer with the current loop number. Start with 1 preferibly
- max.run
Number. Maximum number of loops
- label
String. With additionaly information to be printed at the end of the line. The default is
run
.- msg
Character. Finish message.
- type
Character. Loading type style: equal, domino, sword, filled.
- start_time
POSIXct. Start time to consider. If NA, then when first iteration starts will be set as start time. Useful for when first iteration is showed as done but started a few seconds/minutes ago.
- multiples
Integer. Only print when multiples of N (to avoid) wasting resources on fast and lots of iterations.
- alarm
Boolean. Ping (sound) when done. Requires
beepr
.
See also
Other Tools:
autoline()
,
bind_files()
,
bring_api()
,
chr2num()
,
db_download()
,
db_upload()
,
export_plot()
,
export_results()
,
files_functions()
,
font_exists()
,
formatColoured()
,
formatHTML()
,
get_credentials()
,
glued()
,
grepm()
,
h2o_selectmodel()
,
haveInternet()
,
image_metadata()
,
importxlsx()
,
ip_data()
,
json2vector()
,
list_cats()
,
listfiles()
,
mail_send()
,
markdown2df()
,
move_files()
,
msplit()
,
myip()
,
quiet()
,
read.file()
,
tic()
,
try_require()
,
updateLares()
,
warnifnot()
,
what_size()
Examples
for (i in 1:9) {
statusbar(i, 9, multiples = 2)
Sys.sleep(0.3)
}
#>
00:00:00 [█████████ ] 22.2% | 2
00:00:01 [██████████████████ ] 44.4% | 4
00:00:02 [███████████████████████████ ] 66.7% | 6
00:00:02 [████████████████████████████████████ ] 88.9% | 8
00:00:02 [█████████████████████████████████████████] 100% | 9