progressreport: Print Progress Reports

Description Usage Arguments Details Value Author(s) Examples

Description

Prints Progress Reports during a loop or iterative calculation.

Usage

1
2
3
4
5
6
7
8
progressreport(i, n,
               every = min(100,max(1, ceiling(n/100))),
               tick = 1,
               nperline = NULL,
               charsperline = getOption("width"),
               style = spatstat.options("progress"),
               showtime = NULL,
               state=NULL)

Arguments

i

Integer. The current iteration number (from 1 to n).

n

Integer. The (maximum) number of iterations to be computed.

every

Optional integer. Iteration number will be printed when i is a multiple of every.

tick

Optional integer. A tick mark or dot will be printed when i is a multiple of tick.

nperline

Optional integer. Number of iterations per line of output.

charsperline

Optional integer. The number of characters in a line of output.

style

Character string determining the style of display. Options are "tty" (the default), "tk" and "txtbar". See Details.

showtime

Optional. Logical value indicating whether to print the estimated time remaining. Applies only when style="tty".

state

Optional. A list containing the internal data.

Details

This is a convenient function for reporting progress during an iterative sequence of calculations or a suite of simulations.

It is optional, but strongly advisable, to use the argument state to store and update the internal data for the progress reports (such as the cumulative time taken for computation) as shown in the last example below. This avoids conflicts with other programs that might be calling progressreport at the same time.

Value

If state was NULL, the result is NULL. Otherwise the result is the updated value of state.

Author(s)

\spatstatAuthors

.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  for(i in 1:40) {
     #
     # code that does something...
     # 
     progressreport(i, 40)
  }

  # saving internal state: *recommended*
  sta <- list()
  for(i in 1:20) {
     # some code ...
     sta <- progressreport(i, 20, state=sta)
  }

spatstat documentation built on Aug. 16, 2017, 5:07 p.m.