Graphical message boxes with R package tcltk

[This article was first published on W. Andrew Barr's Paleoecology Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Sometimes you just need a graphical messagebox….know what I mean? If only because it pops up in front of all the other open windows and alerts you to the fact that your R script is waiting for you to do something, or is finished doing something else.

The R package “tcltk” is the easiest way I have found to do this.  On Mac OSX you need to first install the Universal Tcl/Tk for X11(available here).  I haven’t tried it on Windows, but I don’t think this extra step is necessary.  Now just install the R package “tcltk” in the normal way, for example

install.packages(“tcltk”)
library(“tcltk”)

Now you should have access to functions like this…..
tk_messageBox(type=”ok”,message=”I am a tkMessageBox!”)

There are different types of messagebox (yesno, okcancel, etc). See ?tk_messageBox.

To leave a comment for the author, please follow the link and comment on their blog: W. Andrew Barr's Paleoecology Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)