Why and how to use JS in your Shiny app
Posted on September 30, 2022 by Econometrics and Free Software in R bloggers | 0 Comments
[This article was first published on Econometrics and Free Software , and kindly contributed to R-bloggers ]. (You can report issue about the content on this page here )
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Share Tweet
The snake biting its own tail
Disclaimer: I’m a beginner at JS, so don’t ask me about the many intricacies of JS.
I’ve been working on a Shiny app for work these past few weeks, and had to use Javascript to solve a very specific issue I encountered. Something for which, as far as I know, there is no other solution than using Javascript. The problem had to do with dynamically changing the UI of an app. The way to usually achieve this is using renderUI()/uiOutput(). For example, consider the following little app (if you don’t want to run it, watch the video below):
library(shiny) library(ggplot2) data(mtcars) ui