R6 Class for printing current sampling progress
Object is initalised with total number of iterations that are expected to occur. User can then update the object with the add
method to indicate how many more iterations have just occurred. Every time step
* 100 % of iterations have occurred a message is printed to the console. Use the quiet
argument to prevent the object from printing anything at all
step
: real, percentage of iterations to allow before printing the progress to the console
step_current
: integer, the total number of iterations completed since progress was last printed to the console
n
: integer, the current number of completed iterations
n_max
: integer, total number of expected iterations to be completed acts as the denominator for calculating progress percentages
quiet
: logical holds whether or not to print anything
new()
Create progressLogger object
progressLogger$new(n_max, quiet = FALSE, step = 0.1)
n_max
: integer, sets field n_max
quiet
: logical, sets field quiet
step
: real, sets field step
add()
Records that n
more iterations have been completed this will add that number to the current step count (step_current
) and will print a progress message to the log if the step limit (step
) has been reached. This function will do nothing if quiet
has been set to TRUE
progressLogger$add(n)
n
: the number of successfully complete iterations since add()
was last called
print_progress()
method to print the current state of progress
progressLogger$print_progress()
clone()
The objects of this class are cloneable with this method.
progressLogger$clone(deep = FALSE)
deep
: Whether to make a deep clone.
Useful links