<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/r-phone-home-notifications-with-pushoverr/"></div></div><div><a data-url="https://www.r-bloggers.com/r-phone-home-notifications-with-pushoverr/" data-counturl="https://www.r-bloggers.com/r-phone-home-notifications-with-pushoverr/" data-count="horizontal" data-text="R Phone Home: Notifications with pushoverr" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://bconnelly.net/2016/11/R-phone-home/"> Brian Connelly: r</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>There are a lot of times when it would be great if your computer talked to you.<br>
<a target="_blank" rel="nofollow" href="https://cran.r-project.org/package=pushoverr">pushoverr</a> allows you to send yourself or your group notifications from R.<br>
Instead of compulsively checking the status of a running job, you can just have R tell you when it’s done, if it failed, or what the results are.</p>
<p>To get started, download a <a target="_blank" rel="nofollow" href="https://pushover.net/clients">Pushover client</a> for your mobile device or desktop.<br>
Pushover is free for 7 days, but requires a $4.99 license after that.<br>
Once you’ve registered, you’ll get a <strong>user key</strong>, which looks like <code>uQiRzpo4DXghDmr9QzzfQu27cmVRsG</code>.<br>
You can find your user key either in the app’s settings or on <a target="_blank" rel="nofollow" href="https://pushover.net/">Pushover’s website</a> after logging in.</p>
<p>Pushover allows you to create “applications”, which are basically just different channels for your messages.<br>
You can also receive messages from “public applications” like <a target="_blank" rel="nofollow" href="https://github.com/">GitHub</a> (via a service hook), <a target="_blank" rel="nofollow" href="http://ifttt.com/pushover">IFTTT</a>, <a target="_blank" rel="nofollow" href="http://zapier.com/">Zapier</a>, and <a target="_blank" rel="nofollow" href="https://pushover.net/apps">many others</a>.</p>
<h2>Creating Your Application</h2>
<p>All that it takes to create an application dedicated to receiving messages from R is to visit the <a target="_blank" rel="nofollow" href="https://pushover.net/apps/build">create a new application</a> and enter a few fields.<br>
For this demo, I’m going to call it <em>pushoverr</em> (it can be anything you want, though).<br>
The other fields are optional, but I’m going to set an icon.<br>
The <a target="_blank" rel="nofollow" href="https://www.r-project.org/logo/">R Logo</a> seems like a natural fit (scaled down to 72 pixels wide, <a target="_blank" rel="nofollow" href="http://bconnelly.net/assets/files/Rlogo-small.png">download here</a>).<br>
Now, whenever a message arrives, I’ll be able to know at a glance that it came from R.</p>
<p><img alt="Creating our Pushover application" src="https://i0.wp.com/bconnelly.net/assets/img/pushoverr/pushoverr1.png?w=456" data-recalc-dims="1"></p>
<p>Once you’ve agreed to the terms and clicked <em>Create Application</em>, you’ll be taken to the information page for your new application.<br>
Here, you can see some plots of the number of messages sent by your app both recently and over a longer period.<br>
You can also create subscription codes for your applications, which can allow other people to easily subscribe to notifications for that app.<br>
This is really handy for sending notifications to coworkers or even a wider audience.<br>
For now, what’s most important is your <strong>API Token/Key</strong>, which we’ll need to send notifications from this app.<br>
For my demo application here, the API token is <code>avgk9kgxjp2e5xqnn3kzutvh43g27k</code>.</p>
<p><img alt="pushoverr application information page" src="https://i0.wp.com/bconnelly.net/assets/img/pushoverr/pushoverr2.png?w=456" data-recalc-dims="1"></p>
<h2>Sending Notifications</h2>
<p>Now it’s time to start sending some messages.<br>
Start up an R session and install pushoverr:</p>
<pre>
install.packages(&quot;pushoverr&quot;)
</pre>
<p>Once that’s completed, we’re ready to let R start talking.<br>
Load the pushoverr package, and use the <code>pushover</code> function to craft and send your first message.</p>
<pre>
library(&quot;pushoverr&quot;)

pushover(message = &quot;Mr. Watson--come here--I want to see you.&quot;)
</pre>
<p>Since this is your first time, <code>pushover</code> will ask you for your user key and app token.<br>
Don’t use mine.</p>
<p><img alt="setting pushoverr credentials (screenshot)" src="https://i0.wp.com/bconnelly.net/assets/img/pushoverr/pushoverr3.png?w=456" data-recalc-dims="1"></p>
<p>If everything worked, you should see a notification on your device very shortly.</p>
<p><img alt="our first pushoverr notification arrives (screenshot)" src="https://i0.wp.com/bconnelly.net/assets/img/pushoverr/example_message1.png?w=456" data-recalc-dims="1"></p>
<p>Using other arguments to <code>pushover</code>, you can set other aspects of your message, including sounds, links, and message priorities.</p>
<p>Your user key and app token are now saved for the rest of your session, so you can now send messages without having to enter them.<br>
Pushover offers 5 different message priorities, ranging from silent to emergency.<br>
Let’s send an emergency priority message, which will re-send every 30 seconds until it is acknowledged on your device.</p>
<pre>
pushover_emergency(message = &quot;The kittens are awake, and they are ANGRY!&quot;)
</pre>
<p><img alt="Notification: The kittens are awake, and they are ANGRY! (screenshot)" src="https://i2.wp.com/bconnelly.net/assets/img/pushoverr/example_message2.png?w=456" data-recalc-dims="1"></p>
<h2>Displaying Data on Your Wrist</h2>
<p>I previously used <a target="_blank" rel="nofollow" href="http://numerousapp.com/">Numerous</a> to put <a target="_blank" rel="nofollow" href="https://en.wikipedia.org/wiki/Lake_Union">Lake Union’s</a> current temperature on my watch, which I <a target="_blank" rel="nofollow" href="http://www.nwd-wc.usace.army.mil/nws/hh/textdata/lkw_fblw.prn">scraped</a> using R.<br>
It was a great way to know how shocking my daily swim would be.<br>
Numerous shut down earlier this year, so I was extremely excited to see that Pushover recently added the ability to <a target="_blank" rel="nofollow" href="http://updates.pushover.net/post/152731668192/pushing-data-directly-to-a-complication-on-your">push data to smaller screens</a>.</p>
<p>pushoverr can now send several different types of data to your watch.<br>
For example, we can quickly display the current water temperature.</p>
<pre>
water_temp &lt;- 52
update_glance(count = water_temp)
</pre>
<p><img alt="Watch displaying temperature (screenshot)" src="https://i0.wp.com/bconnelly.net/assets/img/pushoverr/watch1.png?w=456" data-recalc-dims="1"></p>
<p>I won’t be swimming today.</p>
<p>We can also send numeric values as a percent, which is good for displaying progress.<br>
There’s also support for small bits of text:</p>
<pre>
update_glance(text = &quot;hello woRld&quot;)
</pre>
<p><img alt="Watch displaying 'hello woRld' (screenshot)" src="https://i0.wp.com/bconnelly.net/assets/img/pushoverr/watch2.png?w=456" data-recalc-dims="1"></p>
<h2>Wrapping Up</h2>
<p>Enabling R to send you bits of information can be extremely useful.<br>
I’ve used Pushover to do this for a few years, but there are several other alternatives.<br>
<a target="_blank" rel="nofollow" href="https://www.pushbullet.com/">Pushbullet</a> is a similar service that offers a few additional features, but does not yet have watch support.<br>
<a target="_blank" rel="nofollow" href="http://dirk.eddelbuettel.com/">Dirk Eddelbuettel</a>’s <a target="_blank" rel="nofollow" href="https://github.com/eddelbuettel/rpushbullet">RPushbullet</a> package allows you to interface with Pushbullet from R.<br>
You can also send notifications from <a target="_blank" rel="nofollow" href="https://ifttt.com/if_notifications">IFTTT</a>.<br>
Check out my previous blog post <a target="_blank" rel="nofollow" href="http://bconnelly.net/2015/06/connecting-r-to-everything-with-ifttt/">Connecting R to Everything with IFTTT</a> to see how to send notifications and a whole lot more.</p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/r-phone-home-notifications-with-pushoverr/"></div></div><div><a data-url="https://www.r-bloggers.com/r-phone-home-notifications-with-pushoverr/" data-counturl="https://www.r-bloggers.com/r-phone-home-notifications-with-pushoverr/" data-count="vertical" data-text="R Phone Home: Notifications with pushoverr" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://bconnelly.net/2016/11/R-phone-home/"> Brian Connelly: r</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/-sRrHLD3lD8"></a></div>