File: notifiers.R

package info (click to toggle)
r-cran-progressr 0.15.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,132 kB
  • sloc: sh: 13; makefile: 7
file content (10 lines) | stat: -rw-r--r-- 394 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
progress_notify <- function(title = "R 'progressr' notification", message, step, max_steps, notifier) {
  stop_if_not(is.function(notifier))
  
  ratio <- if (max_steps == 0) 1 else step / max_steps
  ratio <- sprintf("%.0f%%", 100*ratio)
  msg <- paste(c("", message), collapse = "")
  body <- sprintf("[%s] %s", ratio, msg)
  
  notifier(title = title, message = body)
} ## progress_notify()