Basic JavaScript lessons for Shiny users

Hey, I've recently realized that a lot of my Shiny projects end up with most of the work done before the data gets to Shiny and the role of Shiny will end up only being data filtering and presentation.

If that is the case I reckon, it'd be better to have the page in HTML with the filtering done with JavaScript. The problem is, I don't know JavaScript.

So my question is if anyone knows of a good set of lessons to learn JavaScript specifically to replace a little bit of Shiny functionality? And, I'd love to hear any other experience of learning JavaScript coming from an R background. :grinning:

Cheers, and I hope everyone has a lovely upcoming summer.

3 Likes

i found the below links in my bookmark, hope this helps:


1 Like

Here are few resources that might interest you.

Check out Shiny HTML Templates.

Custom message handlers will help you with this, specifically session$sendCustomMessage and Shiny.onInputChange or Shiny.setInputValue. Check out the Communicating with Shiny via JavaScript guide.

I would recommend Mozilla's JavaScript guide, as well as having a look through the html tutorials (for good semantic practices) and DOM guides (for a conceptual overview).

A bit about my experience - I started learning JavaScript when I when I wanted a specific actions to occur as a result of an event (button click for example). At the time, I didn't have much experience with other languages besides R (I come from the clinical research background). I started with looking at simple examples, reading guides, and practicing (lots of it and then repeating). Once I felt comfortable with the basics, I moved on to learning D3, data handling techniques in js, and then on to popular js libraries (reactJS, gatsbyJS, etc) for building static sites/apps. Recently, I've started learning using nodeJS and express to get familiar with backend work. It's been a few years, but taking that first step was a worth it.

Hope that helps! I'd be happy to answer any questions.

EDIT: forgot to add urls

2 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

Hi @martj42! I was thrilled to find your question because I've been thinking about this exact problem a lot lately. I'll be leading a workshop at rstudio::conf 2020 on JavaScript for Shiny Users. The goal of the workshop is to help Shiny app developers with an R background learn the fundamentals of JavaScript and web development, while definitely keeping one foot firmly planted in R and Shiny.

I encourage you to take a look at the workshop; but even if you can't attend, I'll be sharing the workshop materials online in January 2020. I'll check back in here and post the links then.

In the mean time, here are a few high-quality resources for learning JavaScript.

  1. JavaScript for Data Science by Maya Gans, Toby Hodges, and Greg Wilson. This book is avaiilable online for free and is an excellent and gentle introduction to JavaScript for scientists, engineers, and data scientists.

  2. JavaScript for Cats is a fun and free introduction to JavaScript basics.

  3. The Modern JavaScript Tutorial is a very thorough and free online course for learning JavaScript.

  4. Learn JavaScript has a really nice interactive environment for learning. The first 40 lessons are free, the full course costs about $60.

  5. Beginner JavaScript — Learn JavaScript from Scratch is an online video course from Wes Bos. It costs $140, but Wes is an excellent instructor and his videos are approachable and detailed.

Fore more in-depth or technically-focused reading, the following books are also excellent.

  1. Learning JavaScript

  2. Eloquent JavaScript

  3. Speaking JavaScript

  4. You Don't Know JS Yet: A book series on JavaScript.

4 Likes

This topic was automatically closed after 55 days. New replies are no longer allowed.