USGS - science for a changing world

LMGWSC - Tennessee

October 11th - 13th in Nashville, TN

Installation

See Before the Workshop for information on what software should be installed prior to the course.

Tentative schedule

Day 1

  • 08:00 am - 09:00 am – Instructors available for questions
  • 09:00 am - 10:15 am – Introduction
  • 10:15 am - 10:30 am – Break
  • 10:30 am - 12:00 pm – Get
  • 12:00 pm - 01:00 pm – Lunch
  • 01:00 pm - 02:15 pm – Clean
  • 02:15 pm - 02:30 pm – Break
  • 02:30 pm - 04:00 pm – Clean continued
  • 04:00 pm - 04:30 pm – End of day wrap-up

Day 2

  • 08:30 am - 09:00 am – Instructors available for questions
  • 09:00 am - 10:00 am – Explore
  • 10:00 am - 11:00 am – Analyze: Base
  • 11:00 am - 11:15 am – Break
  • 11:15 am - 12:00 pm – Analyze: EGRET, dataRetrieval vignette and presentation
  • 12:00 pm - 01:00 pm – Lunch
  • 01:00 pm - 02:30 pm – Visualize: ggplot2
  • 02:30 pm - 02:45 pm – Break
  • 02:45 pm - 04:00 pm – Visualize: ggplot2 continued
  • 04:00 pm - 04:30 pm – End of day wrap-up

Day 3

  • 08:00 am - 09:00 am – Project work w/ instructors available for questions
  • 09:00 am - 10:30 am – Repeat
  • 10:30 am - 10:45 am – Break
  • 10:45 am - 11:00 am – The importance of reproducibility
  • 11:00 am - 11:15 am – Automated reporting with R Markdown
  • 11:15 am - 11:30 am – What is Shiny?
  • 11:30 am - 01:00 pm – Practice: USGS R packages, projects (group/individual), or additional topics

Data files

Download data from the Data page.

Additional resources

Instructors

Lindsay Carr (lcarr@usgs.gov) – primary contact

Jennifer Murphy (jmurphy@usgs.gov)

Scott Worland (scworland@usgs.gov)

Lesson scripts

This zip file contains the project folder and .Rproj file with the scripts that the instructors created in the class.

What is Shiny?

Shiny is a web application framework that allows you to present your data and results in an interactive web application. You can script the whole process in R and Shiny will convert that to an html document – no need to learn another computer language. There are lots of example of shiny applications. These apps are useful for sharing results with others or exploring your data and results yourself.

All shiny apps open in a web browser. At the most basic level, R runs in the background on a personal computer and serves the application to a web browser. The user can make changes on the webpage and these changes will be processed in R and updated on the webpage. The interaction allows the user to easily explore their data and analyses based a varying a set of pre-specified inputs.

When the shiny app is hosted on your computer and a colleague asks to use your app, you will need to send them the R files which they would download and run on their computer. However, if the app is hosted on a web server then the shiny app can be served to the internet and anyone with a computer and internet access can use it.

Shiny apps are built using 3 basic components: a user interface (UI), server instructions, and a function that ties the UI and server instructions together. The UI is a web document written in HTML that describes how the webpage should look. With Shiny you don’t actually have to learn HTML to generate this document, instead Shiny converts the script you write in R to HTML. The server instructors tell the app what to show and how to respond to changes made on the webpage by the user. Finally, the UI and the server instructions are joined together using a shiny-specific function.

Spend some time exploring the different types of web applications:

And when you’re ready to try it out yourself use this tutorial or follow this cheat sheet to get the basic steps.

Images from tutorial video at http://shiny.rstudio.com/tutorial/

You can download the example shown in the course from here.