{"id":544,"date":"2010-01-09T22:42:57","date_gmt":"2010-01-10T02:42:57","guid":{"rendered":"http:\/\/scott.sherrillmix.com\/blog\/?p=544"},"modified":"2010-01-11T22:40:00","modified_gmt":"2010-01-12T02:40:00","slug":"progress-bars-in-r","status":"publish","type":"post","link":"http:\/\/scott.sherrillmix.com\/blog\/programmer\/progress-bars-in-r\/","title":{"rendered":"Progress Bars in R"},"content":{"rendered":"

Recently, I’ve had a lot of time consuming tasks running in R where it’s nice to know how the computer is doing. I usually just output the name of the current iteration or a dot or something but I finally decided I should figure out how to make a nice progress bar in R. It turns out it’s really simple since it’s already builtin with the txtProgressBar<\/code> function. So you can do something like:<\/p>\r\n[R]\r\nnumberSteps<-10\r\npb <- txtProgressBar(min = 0, max = numberSteps, style = 3)\r\nfor(i in 1:numberSteps){\r\n setTxtProgressBar(pb, i)\r\n Sys.sleep(1)\r\n}\r\nclose(pb)\r\n[\/R]\r\n\"A\r\n

That’s good enough for me but there’s also winProgressBar<\/code> for a fancy Windows progress bar and tkProgressBar<\/code> (in the tcltk<\/code> package) if you really want to get fancy.<\/p>\r\n\r\n","protected":false},"excerpt":{"rendered":"Recently, I’ve had a lot of time consuming tasks running in R where it’s nice to know how the computer is doing. I usually just output the name of the current iteration or a dot or something but I finally decided I should figure out how to make a nice progress bar in R. It […]","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,417],"tags":[519,229,518,317],"_links":{"self":[{"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/posts\/544"}],"collection":[{"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/comments?post=544"}],"version-history":[{"count":6,"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/posts\/544\/revisions"}],"predecessor-version":[{"id":551,"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/posts\/544\/revisions\/551"}],"wp:attachment":[{"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/media?parent=544"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/categories?post=544"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/scott.sherrillmix.com\/blog\/wp-json\/wp\/v2\/tags?post=544"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}