May 6, 2020

Introduction

Context

  • R is a powerful tool for data analysis
  • Huge amount of tools under development for the community
  • R markdown, Shiny Apps

Illustration

  • Mafalda Project (seabird tracking)

mafalda

R markdown

R markdown

What is it?

  • Document that regroups both narrative text and code
  • Various output format available (html, pdf, word, books, website…)

Why?

  • Very convenient for producing scientific documents
  • articles, presentation, automatic reports…
  • Fully reproducible analysis

HTML Widgets: Interactive Plots

  • Used at the R console for data analysis just like conventional plots
  • Embedded within R markdown documents
  • Incorporated into Shiny apps
  • Saved as stand-alone web page for ad-hoc use

Note: Interactivity only works when the output format is HTML

Plotly

DT

Leaflet

Crosstalk

Where can I find nice htmlwidgets?

How to create my own R Markdown?

  1. Launch Rstudio
  2. File > New File > Rmarkdown
  3. Write text in Markdown / Write code in R
  4. Click on Knitr to render the file

How to create my own R Markdown?

Shiny App

Shiny App

What is it?

  • Interactive Web Application (html)
  • It can eventually be embedded within a R markdown (html)

Why?

  • Interactive visualization of data
  • Web Deployment to adress the public

Note: A shiny App is not a ‘output file’ that can be shared such as R Markdown. It needs to be running on one server

(..but Rstudio provides very convenient and FREE solutions to deploy the app!)

Control Widget: Highly Interactive Plots

Shiny Widget Gallery

How to create my own Shiny App?

  1. Launch Rstudio
  2. File > New File > Shiny Web App
  3. Write ui.R and server.R function
  4. Click on Run App to run the app locally

How to share a Shiny App?

When it comes to sharing Shiny apps, you have two basic options:

Sharing as R script

User need to have R and know how to use it:

  • run from local files: runApp
  • run from github repository: runGithub

Sharing as a web page

  • Use shinyapp.io which provides a free hosting solution
  • Use Shiny Server to build your own linux server

How to create my own Shiny App?

Obrigado pelo atençao