How to make a progress bar in R

March 19, 2009
44 Views

If you’re writing a function that you expect to take a long time to complete, you might want to give feedback to the user (or even just to yourself, during the development phase) that the function is actually still running and hasn’t simply hung. The obvious solution is to include a statement like cat(iter/totaliters,”% complete…”) in the loop. However, if you’re using anything other than the console version of R, the R GUI will hold any such output until the function completes, defeating the purpose. Mark Heckmann explains how you can turn off this “console buffering” feature so that you…

If you’re writing a function that you expect to take a long time to complete, you might want to give feedback to the user (or even just to yourself, during the development phase) that the function is actually still running and hasn’t simply hung.  The obvious solution is to include a statement like

cat(iter/totaliters,”% complete…”)

in the loop. However, if you’re using anything other than the console version of R, the R GUI will hold any such output until the function completes, defeating the purpose. Mark Heckmann explains how you can turn off this “console buffering” feature so that you can see the progress output.  But then he goes one better: how about building a graphical progress bar?  See his post for a neat example of building such GUI elements with Tcl/Tk.

You may be interested

How SAP Hana is Driving Big Data Startups
Big Data
298 shares3,060 views
Big Data
298 shares3,060 views

How SAP Hana is Driving Big Data Startups

Ryan Kh - July 20, 2017

The first version of SAP Hana was released in 2010, before Hadoop and other big data extraction tools were introduced.…

Data Erasing Software vs Physical Destruction: Sustainable Way of Data Deletion
Data Management
60 views
Data Management
60 views

Data Erasing Software vs Physical Destruction: Sustainable Way of Data Deletion

Manish Bhickta - July 20, 2017

Physical Data destruction techniques are efficient enough to destroy data, but they can never be considered eco-friendly. On the other…

10 Simple Rules for Creating a Good Data Management Plan
Data Management
69 shares664 views
Data Management
69 shares664 views

10 Simple Rules for Creating a Good Data Management Plan

GloriaKopp - July 20, 2017

Part of business planning is arranging how data will be used in the development of a project. This is why…