Learn R Programming

SciViews (version 0.8-8)

progress: Display progression of a long calculation on the console

Description

Display progression level of a long-running task in the console. Two mode can be used: either percent of achievement (55%), or the number of items or steps done on a total (1 file on 10 done...).

Usage

progress(value, max.value = NULL)

Arguments

value
~~Describe value here~~
max.value
~~Describe max.value here~~

Value

  • This function returns NULL invisibly. It is invoked for its side effects.

Details

The function uses backspace (\8) to erase characters at the console.

Examples

Run this code
# 1) A simple progress indicator in \%
	cat("Simple progress indicator in %:
")
	for (i in 1:101) {
		progress(i)
		Sys.sleep(0.05)
	}
	cat("Done!
")

	# 2) A progress indicator with 'x on y'
	cat("A variation...
")
	for (i in 1:31) {
		progress(i, 30)
		Sys.sleep(0.2)
	}
	cat("Done!
")

Run the code above in your browser using DataLab