Announcing pingr: The R Package that Sounds as it is Called
Rasmus Bååth
[This article was first published on Publishable Stuff, 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.
< !DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
pingr is an R package that contains one function, ping(), with one purpose: To go ping on whatever platform you are on (thanks to the audio package). It is intended to be useful, for example, if you are running a long analysis in the background and want to know when it is ready. It’s also useful if you want to irritate colleagues. You could, for example, use ping() to get notified when your package updates have finished:
update.packages(ask=FALSE); ping()
< !-- more -->
ping() does not only go ping but lets you choose nine different sounds specified by a number (ping(3)) or a name (ping("fanfare")). Bonus points if you can identify where sound two to nine comes from!
Installation
pingr is currently residing on GitHub and is never going to be on CRAN, instead grab Hadley Wickham’s devtools and install pingr directly from GitHub by entering this into an R console:
If you’re on Linux pingr relies on you having the vlc media player installed and on the PATH. If you are on Debian/Ubuntu you can get vlc by running the following in a terminal:
sudo apt-get install vlc
Why pingr?
So occasionally I’m running a Bayesian analysis that takes a couple of minutes. But instead of wasting my time looking at a progress bar the following often happens:
…and this:
…and this:
… and so on. Uncountable cat gifs later I’ve wasted one hour “waiting” on a five minute analysis (more cat gifs here btw, but don’t say I didn’t warn you…). Oh, the hours I would save if I just easily could make R go ping when the analysis is finished, ergo pingr.
A supposedly quick way of getting R to make a sound is using the built in alarm() function. But on my setup, and others I’ve tried, that doesn’t work. pingrshould be cross platform as it relies on the audio package on Windows and Mac and on VLC on Linux. I’ve tested it on Ubuntu 12.04, Windows 7 and OS X 10.6 but if it doesn’t work for you tell me and I might be able to sort it out.
To leave a comment for the author, please follow the link and comment on their blog: Publishable Stuff.