Skip to content

A presentation on interactive documents produced with RMarkdown, flexdashboard, and shiny

Notifications You must be signed in to change notification settings

landisrm/rTED_2020

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Moving pictures: Interactive documents with R and Markdown

Goals for this talk

  • Share my experience creating a tool for visualizing household travel survey data (htsViewer)
  • Demonstrate some tools for presenting data
    • internally for quality assurance, communication to colleagues
    • externally for reporting to clients
  • Focus is on interactive data presentation

htsViewer

Outline

  • R + Markdown = RMarkdown
  • leaflet
  • DT (DataTable)
  • flexdashboard
  • crosstalk
  • Shiny

R + Markdown = RMarkdown

R

  • If you work with data, you probably already know a lot about R
  • if you don't, it's one of the main computer languages we use here at RSG
  • Extremely versatile language for data analysis
  • One of the most widely used data languages in the world, along with SQL and Python
  • Based heavily on S, a statistical computer language developed at Bell Labs in the 1970's
  • Excellent data visualization facilities built-in

Markdown

## Markdown

This is **Markdown**, a lightweight markup language. You use it to format text.

I like it because:

  - It is very readable even in plain text
  - code is easy to distinguish: `foo`, `bar`, `baz`.
  - It's versatile!  Use in  [Teams](https://support.microsoft.com/en-ie/office/use-markdown-formatting-in-teams-4d10bd65-55e2-4b2d-a1f3-2bebdcd2c772) and [Github](https://guides.github.com/features/mastering-markdown/), not to mention [RStudio](https://rmarkdown.rstudio.com/).
  - Create HTML pages, presentations, Word docs, PDF, dashboards, etc.
  - Learn more at [markdownguide.org](https://www.markdownguide.org/getting-started/) and try it out at [dillinger.io](https://dillinger.io/).

Markdown

This is Markdown, a lightweight markup language. You use it to format text.

I like it because:

  • It is very readable even in plain text
  • code is easy to distinguish: foo, bar, baz.
  • It's versatile! Use in Teams and Github, not to mention RStudio.
  • Create HTML pages, presentations, Word docs, PDF, dashboards, etc.
  • Learn more at markdownguide.org and try it out at dillinger.io.

RMarkdown

  • Combines plain text of Markdown with R code
  • Compiling replaces R code with output of R - figures, tables, text
  • Can export to HTML, PDF, Word, presentations (like this one), dashboards
  • Can produce interactive documents with htmlwidgets or shiny (or both combined)
  • Easy to share as a stand-alone HTML file
  • Results can use RSG branding (CSS is helpful)
  • Show [example](https://github.com/landisrm/rTED_2020/blob/main/01_rmarkdown_static.Rmd

Interactive Documents

htmlwidgets

flexdashboard

crosstalk

  • https://rstudio.github.io/crosstalk/
  • Interactivity between widgets through shared data object
  • Very simple to set up
  • All client side. No server. (easy to share as a file)
  • Limitations
    • Dataset has to be relatively small (fits in file)
    • Not all graphics are supported (e.g. histograms, lines on maps)
    • Not many packages can interact with crosstalk
      • DT
      • Leaflet
      • Plotly
  • Show example

Shiny

  • https://shiny.rstudio.com/
  • R package for building interactive web apps
  • Much more flexible than RMarkdown alone but harder to set up
  • RStudio has ability to run locally (e.g. htsViewer)
  • Sharing requires a web server
  • We (RSG) have an account on shinyapps.io

shinyapps.io

shinyapps.io

  • Excellent for sharing Rmarkdown and Shiny web apps
  • Share a link instead of a file
  • Easier to debug and modify than a set of scripts sent to client
  • Custom URLs, e.g. demo.rsginc.com/rted_2020/shiny_test/
  • Secure
    • Can manage access to individuals
    • Can access databases so data isn't stored in web page

Summary

Packages

  • rmarkdown
  • leaflet
  • datatable
  • flexdashboard
  • crosstalk
  • shiny
  • shinyapps.io

Links

About

A presentation on interactive documents produced with RMarkdown, flexdashboard, and shiny

Resources

Stars

Watchers

Forks

Languages