demo/ProgressBar.r

myFunction = function(nPoints, progressbar=NULL, progresslabel=NULL){
    # Do something that takes a long time
  N = 10
  for(i in 1:N){
    Sys.sleep(0.5)
    if(!missing(progressbar)) progressbar$setFraction(i/N)
    if(!missing(progresslabel)) progresslabel$setText(paste(signif((i)/N*100, 2), "% done"))
  }
  print("Finished")
}

myFunction.dialog = list(show.progress = TRUE, nPoints.integerItem = 10, label = "Number of points to plot")

run.dialog(myFunction)

Try the RGtk2Extras package in your browser

Any scripts or data that you put into this service are public.

RGtk2Extras documentation built on May 29, 2017, 11:19 a.m.