Thursday, October 18, 2007

Make R beep

To make R beep when you want to alert users about an error, simply type:

alarm()

or

cat("\a")

or

library(tcltk)
tkbell()

The sound is not that "alarming" though, as far as I know, it is the only way R beeps.

2 comments:

Anonymous said...

The last one does not work. I got


> library(tcltk)
> tkbell()
Tcl


with <> for "Tcl"

Yu-Sung Su said...

The message is correct. Make sure you have your volumne tuned up. The sound is just a short beep sound.