Postive Feedback in R with a Little Javascript

October 22, 2014
By

(This article was first published on Timely Portfolio, and kindly contributed to R-bloggers)

Let’s face it, sometimes the struggle in R can become frustrating, depressing, daunting, or just monotonous.  For those moments when you need a little positive feedback, some encouragement, or a pat on the back, I thought this might help.  Maybe I should make this into a package.

I found this from Sweet Alert for Bootstrap forked from Tristan Edwards non-bootstrap SweetAlert.  This builds on the technique used in my previous post SVG + a little extra (d3.js) in RStudio Browser | No Pipes This Time.

positive_feedback_sweetalert_r

# give yourself some positive feedback in R
# as you toil away on some difficult, but worthwhile task
# uses javascript sweet-alert https://github.com/t4t5/sweetalert

library(htmltools)
library(pipeR)

tagList(
  tags$script(
    '
    document.addEventListener("DOMContentLoaded", function(event) { 
      swal("Good job! Brilliant!", "You\'re doing worthwhile things.", "success")
    });
    '
  )
) %>>%
  attachDependencies(
    htmlDependency(
      name="sweet-alert"
      ,version="0.2.1"
      ,src=c("href"=
               "http://timelyportfolio.github.io/sweetalert/lib"
      )
      ,script = "sweet-alert.min.js"
      ,style = "sweet-alert.css"
    )
  ) %>>%
  html_print

 

To leave a comment for the author, please follow the link and comment on their blog: Timely Portfolio.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)