Last active
August 29, 2015 14:23
-
-
Save dalejbarr/da127ab789f2ada3998e to your computer and use it in GitHub Desktop.
buzz_me(): receive notifications on your mobile from R!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Inspired by http://bconnelly.net/2015/06/connecting-r-to-everything-with-ifttt/ | |
## NB: set up IFTTT Maker channel to watch for R_event and then notify. | |
## Get your own personal maker key from https://ifttt.com/maker | |
## Put the code snippet below in ~/.Rprofile | |
buzz_me <- function(msg = "DONE!", event = "R_event") { | |
maker_key <- "yOuR_maKER_keY_GoES_HerE" | |
url <- paste0("https://maker.ifttt.com/trigger/", event, "/with/key/", maker_key) | |
if (requireNamespace("httr", quietly = TRUE)) { | |
invisible(httr::POST(url, body = list(value1 = msg), encode = "json")) | |
} else { | |
warning("you need to install 'httr' to use this function") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's an example of possible usage with magrittr pipes. The idea is that the function
parse_output()
takes the result ofslow_modeling_function()
as an argument and describes it with a single character string, which is passed along tobuzz_me()
. (You'll have to write your ownslow_modeling_function()
andparse_output()
functions, of course.)The
%T>%
pipe makes it somod
receives the result of the fitting function, since theparse_output(.) %>% buzz_me()
sequence is used only for its side effect.