Skip to content

Repository for the R Shiny materials for Macrosystems EDDIE Module 5

Notifications You must be signed in to change notification settings

MacrosystemsEDDIE/module5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Module 5: Introduction to Ecological Forecasting

DOI

Summary

Here is the code for running the Macrosystems EDDIE Module 5: Introduction to Ecological Forecasting. Below are instructions on how to access the Shiny app via a web browser and also a detailed guide below for launching the R Shiny App locally on your own computer. For more details about teaching this module please visit our website.

Module Workflow

  1. Using shinyapps.io
  • This option works well if there are not too many simultaneous users (<50)
  • The app generally does not take a long time to load but requires consistent internet access
  • It is important to remind students that they need to save their work as they go, because this webpage will time-out after 15 idle minutes. It is frustrating for students to lose their progress, so a good rule of thumb is to get them to save their progress after completing each objective
  1. The most stable option for large classes is downloading the app and running locally, see instructions below
  • Once the app is downloaded and installed (which requires an internet connection), the app can be run offline locally on students’ computers
  • This step requires R and RStudio to be downloaded on a student’s computer, which may be challenging if a student does not have much R experience (but this could be done prior to instruction by an instructor on a shared computer lab)
  • If you are teaching the module to a large class and/or have unstable internet, this is the best option

Accessing the Shiny App via a web browser

The Shiny app for this module can be accessed through any internet browser at shinyapps.io.

Running the Shiny App on your computer

Pre-requisites

  1. Latest version of R installed (currently R 4.3.1 as of 2023-06-16).
  2. RStudio installed.

Step 1: Download this repository

There are two options:

  1. Download the repository as a .zip file. (Easiest option).
    a. Click the green "Code" button on this page and select "Download ZIP".
    b. Unzip this file on your computer.
  2. Clone this repository into RStudio.
    a. Open RStudio.
    b. Click "File > New Project...".
    c. In the "Create Project dialog select "Version Control: Checkout a project from a version control repository".
    d. Select "Git: Clone a project from a Git repository.
    e. In the "Repository URL:" option input the URL to this repository, select where to save the project directory.
    f. Click "Create Project".
    g. You will then have a project with all the files from this repository.

Step 2: Install required R packages

  1. The list of required of packages is detailed in the install.R script in this repository. Open and run this script to install the necessary packages.
    Watch out for errors in package installation. Most can be avoided using the most up-to-date version of R (4.3.1 as of 2023-06-16).
    Updating of current R packages on your system is recommended.

Step 3: Launch Shiny App

  1. Open either of the scripts app/global.R, app/server.R or app/ui.R in your console.
  2. Click the "Run App" button in the Script (indicated below).
  3. This will launch the Shiny App in your default web browser or in a new RStudio window. The Shiny App is run from RStudio so you will need to keep RStudio running in the background.

Quickstart option

Here is an alternative way to quickly launch the Shiny app in less than a minute, but can be prone to package installation errors if your packages have not been updated recently.

# Step 1. Install required R packages
source("https://raw.githubusercontent.com/MacrosystemsEDDIE/module5/main/install.R")

# Step 2. Launch Shiny app
shiny::runGitHub("module5", "MacrosystemsEDDIE", ref = "main", subdir = "app")

Questions & Feedback

If you have any questions, comments or feedback related to these materials you can send an email to macrosystemseddie@gmail.com.