Learn R Programming

cape (version 2.0.2)

report.progress: Print the progress of a function to the screen

Description

This is an internal function that takes in the current position in a process and the total length of the process and prints to the screen the percent progress at the specified increments.

Usage

report.progress(current, total, percent.text = 10, percent.dot = 2)

Arguments

current
A numeric value specifying the current position in the process.
total
A numeric value specifying the total number of steps in the process
percent.text
A numeric value indicating the frequency at which the percent done should be reported. The default value is 10 indicating that text indicating the progress is printed to the screen when the process is 10, 20, 30 percent done, etc.
percent.dot
A numeric value indicating the frequency at which dots in between text reports are printed. The default value is 2 indicating that a dot is printed to the screen when the process is 2, 4, 6 percent done, etc.

Value

This function does not return any values but prints values to the screen.

Examples

Run this code
	
#report progress every 10 percent, print dots every 2%
all.steps <- 1:100
for(i in all.steps){
	report.progress(i, total = length(all.steps), percent.text = 10, percent.dot = 2)
}

#report progress every 25 percent, print dots every 5%
all.steps <- 1:100
for(i in all.steps){
	report.progress(i, total = length(all.steps), percent.text = 25, percent.dot = 5)
}

Run the code above in your browser using DataLab