We at STATWORX work a lot with R and we often use the same little helper functions within our projects. These functions ease our daily work life by reducing repetitive code parts or by creating overviews of our projects. At first, there was no plan to make a package, but soon I realised, that it will be much easier to share and improve those functions, if they are within a package. Up till the 24th December I will present one function each day from
helfRlein. So, on the 6th day of Christmas my true love gave to me…
What can it do?
This little helper prints a progress bar into the console for loops.
There are two nessecary parameters to feed this function:
runis either the iterator or its number
max.runis either all possible iterators in the order they are processed or the maximum number of iterations.
So for example it could be
run = 3and
max.run = 16or
run = "a"and
max.run = letters[1:16].
Also there are two optional parameter:
percent.maxinfluences the width of the progress bar
infois an additional character, which is printed at the end of the line. By default it is
A little disadvantage of this function is, that it does not work with parallel processes. If you want to have a progress bar when using
apply functions check out
Have a merry advent season!
R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more…