R/progress.R

Defines functions end_progress update_progress init_progress

init_progress <- function(T) {
  # init progress
  cat("[---------|---------|----------|---------|---------|---------|---------|---------|---------|---------]\r");
  cat("[");
  
  steps = table(ceiling((1:100)*T/100))
  
  return(steps)
}

update_progress <- function(t, steps) {
  if (t %in% names(steps))
    cat(paste0(rep("=", steps[[as.character(t)]]), collapse = ""));
}

end_progress <- function() {
  cat("]\n");
}

Try the opera package in your browser

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

opera documentation built on Dec. 11, 2021, 9:07 a.m.