Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
New progress bar with estimated remaining time. #4
I love your package. It's very helpful, but I have always missed one functionality - printing of estimated remaining time.
So I have added new, custom progress bar to your package with this time estimation:
pbreplicate(1000, Sys.sleep(runif(1, 0.01))) # |+++ | 2.70% ~09m 05s pbreplicate(100000, Sys.sleep(runif(1, 0.1))) # |+ | 0.02% ~13h 08m 28s
I hope it will be usefull:)
pb = startpb(max = 100) # | | 0.00% ~~calculating pb() # |+ | 1.00% ~00s
OK, so it works and does the job right, thanks. I called it 'timer' instead of 'custom' and is still the default because I think it is neat. I did some timings and couldn't detect any noticeable overhead due to extra calculations and string processing.
I'd like to follow the functions
I already had a look and the best way is probably have elapsed time (since start time) stored with the value, so that the
I was also thinking about replacing the progress bar (
I thought about R RefClass (http://www.inside-r.org/r-doc/methods/referenceclasses), but I looked at the implementation of txtProgressBar, and changed my mind.
Now there is a function called timerProgressBar - and it has similar interface as txtProgressBar. So that setTimerProgressBar, and getTimerProgresBar are just:
setTimerProgressBar <- setTxtProgressBar getTimerProgressBar <- getTxtProgressBar
timerProgressBar inherits from txtProgressBar:)
I think it is more consistent.