I felt compelled to dust off my 2013 Valentine’s Day
#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 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
iframebelow is pointing to the shiny app)
- refresh the target shinyapps.io app
- run it locally via
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.
Now there’s even one more way to have a data-driven romance!
Oh, and Happy Valentine’s Day @mrshrbrmstr!!