I felt compelled to dust off my 2013 [Valentine’s Day](http://rud.is/b/2013/02/14/happy-valentines-day-mrshrbrmstr/) `#rstats` post and make it all Shiny and new again. I used the same math from that post, but made the polygon a bit sharper and used ggplot2 for the plotting.

To kick it up a bit, I decided to pay homage to a local company (Necco) who makes the venerable [Sweethearts candies](http://www.necco.com/candy/sweethearts.aspx) that are popular this time of year (at least in the U.S.). The heart color is randomized to take on one of the signature pastels of the candy and I took the various sayings that have been on their hearts over the years (except 2006, which was a strange year) and also randomized them. The plot also displays the year of the saying.

I wrapped it all up in a Shiny bow, so all you have to do to get a new heart/saying is refresh the page!

To play with it, you can:

– refresh this post (since the `iframe` below is pointing to the shiny app)
– refresh the target [shinyapps.io app](https://hrbrmstr.shinyapps.io/SweetheaRstats/)
– run it locally via `shiny::runGist(“cf34f7230c88bd99b153”)`

NOTE: You’ll probably want/need to run it locally. I only have a free ShinyApps account and it’ll probably run out of free CPU time depending on when you’re reading this post.

The surprisingly small bit of code is in [this gist](https://gist.github.com/hrbrmstr/cf34f7230c88bd99b153).

Now there’s even one more way to have a data-driven romance!

Oh, and Happy Valentine’s Day @mrshrbrmstr!!

Buy on AmazonDDS Blog
DDS PodcastAmazon Author Page

4 Comments SweetheaRstats

  1. Pingback: Security-Vision » SweetheaRstats

  2. Pingback: SweetheaRstats | infopunk.org

  3. David F. Severski

    Thanks for the pre-V-day treat!

    How did you determine the color codes to use to match the physical Necco Sweethearts? Is there a reference post on the heart equations to help walk through why shifting from 2 to 5 multiples of pie increases the level of detail?


Leave a Reply