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)n).i is a multiple of every.i is a multiple of tick."tty" (the default), "tk" and "txtbar".
See Details.style="tty".state was NULL, the result is NULL.
Otherwise the result is the updated value of state.
style="tk"thentcltk::tkProgressBaris
used to pop-up a new graphics window showing a progress bar.
This requires the packageiincreases from 1 ton, the bar will lengthen.
The argumentsevery, tick, nperline, showtimeare ignored.style="txtbar"thentxtProgressBaris
used to represent progress as a bar made of text characters in theRinterpreter window.
Asiincreases from 1 ton, the bar will lengthen.
The argumentsevery, tick, nperline, showtimeare ignored.style="tty"(the default),
then progress reports are printed to the
console. This only seems to work well under Linux.
Asiincreases from 1 ton,
the output will be a sequence of dots (one dot for everytickiterations), iteration numbers (printed when iteration number is
a multiple ofeveryor is less than 4),
and optionally the estimated time
remaining. For example[etd 1:20:05]means an estimated time
of 1 hour, 20 minutes and 5 seconds until finished. The estimated time remaining will be printed only ifstyle="tty", and the argumentstateis given,
and eithershowtime=TRUE, orshowtime=NULLand the
iterations are slow (defined as: the estimated time remaining
is longer than 3 minutes, or the average time per iteration is
longer than 20 seconds).
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.
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)
}Run the code above in your browser using DataLab