Publishable Stuff

Rasmus Bååth's Blog

Announcing pingr: The R Package that Sounds as it is Called



pingr is now on CRAN! Due to requests from the CRAN mantainers the ping() function had to be renamed beep() in order to not be confused with the Unix tool ping. Thus the package is now called beepr instead and can be downloaded from CRAN by running the following in an R session:


So just replace pingr and ping with beepr and beep below, otherwise everything is the same :)

Original post:

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()

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!


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:

install_github("pingr", "rasmusab")

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:

Cat 1

…and this:

Cat 2

…and this:

Cat 3

… 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. pingr should 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.

Posted by Rasmus Bååth | 2014-01-27 | Tags: R