R Shiny EPID 799 C Fall 2017 Today


















- Slides: 18
R Shiny EPID 799 C Fall 2017
Today: Examples & Patterns Intro to Shiny • Basics • Dashboards Hands on • Default app • Births app • Apps I’m working on • R in other pathways (Javascript / D 3)
But first! Web apps the usual way • • HTML/XML Javascript (D 3, special APIs) CSS Prep work in multiple other languages / applications (Arc. GIS, inkscape / photoshop, etc. ) ^ Note: this is what “real” web folks ($$$ NYT) are currently doing, for the most part. Let’s look at an example: my final (WIP) project due next week. : / www. unc. edu/~fliss/INLS 641/project/
Why it’s hard • Data and server setup can be annoying • Building histograms by hand is no fun • Requires multiple languages
Shiny Basics
Shiny Basics
Shiny Basics
Shiny Basics
Shiny Basics: Even More Widgets http: //gallery. htmlwidgets. org/
Shiny Basics
Shiny Basics UI • Can also directly write HTML (as functions) if you want to for max flexibility. • Handles javascript and css too. Layouts: • Base has layout tools, dashboard has some more.
Shiny Basics: Where to start? https: //shiny. rstudio. com/gallery/ Gallery Start Simple for a great place to start. Also multiple tutorials (of course!) online.
Improving Shiny: Dashboards with flexdashboard and shinydashboard Comparison of two options: flexdashboard R Markdown Super easy Static or dynamic CSS flexbox layout shinydashboard* Shiny UI code Not quite as easy Dynamic Bootstrap grid layout *What I use https: //shiny. rstudio. com/articles/dashboards. html
RMarkdown flexdashboards http: //rmarkdown. rstudio. com/flexdashboard/index. html
A CDC example https: //gallery. shinyapps. io/CDCPlot/
Shiny Gadgets • Lives inside R Studio as an Add. In • Helps you do your analysis • Design your own buttons! • Written in shiny app/server syntax
Shinyapps. io • Free or very cheap server space • Integrates seamlessly with Rstudio • Upload your completed apps with a click
Let’s Try! • Default Shiny App • Births shiny app • Fancier apps (WIP) • https: //mikedolanfliss. shinyapps. io/NCDETECT_Prototype/ • https: //injuryfreenc. shinyapps. io/Opioid. Action. Plan/ • D 3/Javascript • www. unc. edu/~fliss/INLS 641/project/