progress-class: Classes "progress", "progress.file" and "progress.console"

Description Objects from the Class progress.file constructor progress.console constructor Common slots progress.console slots progress.file slots Methods Author(s) Examples

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.time returns used to compute the ETA

eraseLength:

Single integer value, nchar in 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) and iCurrent, the new value for the iteration index. On each update, a message will be printed according to the class of the updated object.

Author(s)

Sylvain Mareschal

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
  # 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()

ODB documentation built on March 26, 2020, 7:46 p.m.