| progress-class {ODB} | R Documentation |
Classes "progress", "progress.file" and "progress.console"
Description
The two last classes inherit from the first one, and describe textual progression outputs.
Objects from the Class
progress is an abstract class that should not be instantiated.
progress.file and progress.console objects are to be created by the new function, as initialize methods are implemented for each of them.
See the Examples section.
progress.file constructor
Objects can be created by new with the following arguments :
main:Directly transfered in the appropriate slot
iMax:Directly transfered in the appropriate slot
iCurrent:Directly transfered in the appropriate slot
nSteps:Approximative amount of steps, to pass to
pretty
progress.console constructor
Objects can be created by new with the following arguments :
main:Directly transfered in the appropriate slot
iMax:Directly transfered in the appropriate slot
iCurrent:Directly transfered in the appropriate slot
Common slots
main:Single character value, the title to print at beginning
iMax:Single integer value, the maximum value for the iteration index
iCurrent:Single integer value, the current value of the iteration index
progress.console slots
pTimes:Float vector,
proc.timereturns used to compute the ETAeraseLength:Single integer value,
ncharin the previous output
progress.file slots
steps:Integer vector, iteration indexes for which print an output
Methods
- initialize
Constructors of the classes, see previous sections.
- set
Updates a progression objects. Takes two arguments :
progress(the object to update) andiCurrent, the new value for the iteration index. On each update, amessagewill be printed according to the class of the updated object.
Author(s)
Sylvain Mareschal
Examples
# File oriented progression
testFun = function() {
obj <- new("progress.file", main="Iterating", iMax=20)
for(i in 1:20) {
obj = set(obj, i)
Sys.sleep(0.1)
}
}
testFun()
# Console oriented progression
testFun = function() {
obj <- new("progress.console", main="Iterating", iMax=20)
for(i in 1:20) {
obj = set(obj, i)
Sys.sleep(0.1)
}
}
testFun()