The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
Place iteration()
inside a loop and it will print the
loop iteration to the console at useful intervals. Here’s a
demonstration
This loop provides no feedback about where it is up to:
for(i in 1:100000) {
2 * 2
}
Place iteration()
inside the loop to print the loop
iteration at intervals of 10, 20, 50, 100, 200, 500, 1000, 2000, 5000,
etc:
for(i in 1:100000) {
2 * 2
iteration()
}# 10
# 20
# 50
# 100
# 200
# 500
# 1,000
# 2,000
# 5,000
# 10,000
# 20,000
# 50,000
# 100,000
Install from GitHub with
devtools::install_github("stevecondylios/iteratoR")
.
Example:
::install_github("stevecondylios/iteratoR")
devtools
library(iteratoR)
for(i in 1:100000) {
2 * 2
iteration()
}
When the iterator is something other than ‘i’ (example: ‘page’):
for(page in 1:100000) {
2 * 2
iteration("page")
}
Use custom iteration intervals:
for(i in 1:100000) {
2 * 2
iteration(iteration_values = seq(0, 1e5, 1e4))
}
iteration()
may be great for slow or medium paced loops,
but may add considerably to the execution time of extremely fast loops,
so use with care:
# Performing 2 * 2 a billion times takes ~10 seconds without iteration()
for(i in 1:1000000000) {
2 * 2
}
# This very fast loop cycle would be slowed down considerably if iteration()
# was used. That is, it adds 0.3 of a millisecond per iteration; about 4 seconds
# per 100,000 iterations
<- Sys.time()
start_time for(i in 1:100000) {
2 * 2
iteration()
}<- Sys.time()
end_time - start_time end_time
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.