R/progress.R

Defines functions new_progress

new_progress <- function() {
        n <- 0L
        chars <- c("|", "/", "-", "\\", "|", "/", "-", "\\")
        show <- function()
        {
                n <<- n + 1L
                cat("Processed ", format(n, width = 9), " batches", 
                    file = stderr())
                cat(" ", chars[n %% length(chars)], file = stderr())
                cat("\r", file = stderr())
                flush(stderr())
        }
        terminate <- function() 
        {
                cat("\n", file = stderr())
                flush(stderr())
        }
        list(show = show, terminate = terminate)
}

Try the kgrams package in your browser

Any scripts or data that you put into this service are public.

kgrams documentation built on Oct. 6, 2023, 5:06 p.m.