File: FileProgressBar.R

package info (click to toggle)
r-cran-r.utils 2.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,936 kB
  • sloc: sh: 18; makefile: 6
file content (14 lines) | stat: -rw-r--r-- 302 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
library("R.utils")

# Creates a progress bar (of length 100) that displays it self as a file.
pb <- FileProgressBar("~/progress.simulation")
reset(pb)
while (!isDone(pb)) {
  x <- rnorm(3e4)
  increase(pb)
  # Emulate a slow process
  if (interactive()) Sys.sleep(0.1)
  Sys.sleep(0.01)
}

cleanup(pb)