mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 15:21:58 +02:00
fix documentation
This commit is contained in:
@ -1174,6 +1174,7 @@ font_stripstyle <- function(x) {
|
||||
|
||||
progress_ticker <- function(n = 1, n_min = 0, print = TRUE, ...) {
|
||||
if (print == FALSE || n < n_min) {
|
||||
# create fake/empty object
|
||||
pb <- list()
|
||||
pb$tick <- function() {
|
||||
invisible()
|
||||
@ -1183,16 +1184,17 @@ progress_ticker <- function(n = 1, n_min = 0, print = TRUE, ...) {
|
||||
}
|
||||
set_clean_class(pb, new_class = "txtProgressBar")
|
||||
} else if (n >= n_min) {
|
||||
# rely on the progress package if it is available - it has a more verbose output
|
||||
# use `progress`, which also has a timer
|
||||
progress_bar <- import_fn("progress_bar", "progress", error_on_fail = FALSE)
|
||||
if (!is.null(progress_bar)) {
|
||||
# so we use progress::progress_bar
|
||||
# a close() method was also added, see below this function
|
||||
pb <- progress_bar$new(
|
||||
format = "[:bar] :percent (:current/:total)",
|
||||
format = "(:spin) [:bar] :percent (:current/:total,:eta)",
|
||||
total = n
|
||||
)
|
||||
} else {
|
||||
# use base R
|
||||
pb <- utils::txtProgressBar(max = n, style = 3)
|
||||
pb$tick <- function() {
|
||||
pb$up(pb$getVal() + 1)
|
||||
@ -1206,6 +1208,7 @@ progress_ticker <- function(n = 1, n_min = 0, print = TRUE, ...) {
|
||||
#' @export
|
||||
#' @noRd
|
||||
close.progress_bar <- function(con, ...) {
|
||||
# for progress::progress_bar$new()
|
||||
con$terminate()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user