##' Play sound once a long-running pipe has finished
##'
##' ...
##' @param x some input
##' @return the input; function is called for side effects
##' @export
oink <- function(x, what = NULL) {
if (is.null(what)) {
if (suppressPackageStartupMessages(require(oblique))) {
what <- oblique::oblique()
} else {
quotes <- suppressWarnings(readLines("http://www.textfiles.com/humor/TAGLINES/cute.say")[5:87])
what <- sample(quotes, 1)
}
cat(what, file = "~/.oinkfile")
}
system("cat ~/.oinkfile | say -v Karen && rm ~/.oinkfile")
x
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.