Setup

R is a programming language that will be used for this workshop.

RStudio is a software application to write and run R code.

GitHub is an online platform that lets people store, manage, and share their code. Github uses version control software called Git that keeps track of changes for all files inside a folder. We call a folder that uses Git to track changes a repository.

GitHub Codespaces provide an online development environment where people can run their code online without installing stuff on their computer.

GitHub Classroom is a tool that teachers can use to share, manage, and grade assignments.

Visual Studio Code is a software application to write and run code in a variety of languages.

There are several ways to setup a computer for the material covered in this workshop.

  1. For people who attend the in-person workshop, setup the software, data, and code on Codespaces using the workshop’s Github Classroom. You can run the software for free, with no hard limit on the number of hours per month. Follow the Initial Setup instructions on this page.
  2. For people who did not attend the in-person workshop, setup the software, data, and code on Codespaces using your Github account. You can run the software for free for 60 hours per month. Visit the Setup - Codespace on my Github account page.
  3. Install all the software, data, and code on your computer. You can run the software for free for an unlimited number of hours. Visit the Setup - local page.

Intitial Setup

This workshop use GitHub to host and run the code, data, software, and infrastructure needed for the workshop. Attendees will not need to install stuff on their own computer; everything is available online using GitHub.

It will take about ten minutes to set things up on Github.

Create Github account

If you don’t have a Github account, create an account.

  1. Sign up for a GitHub account.
  2. After you login, update your settings.
  3. Go to Emails settings.
    1. Select ‘Keep my email addresses private’. ‘Block command line pushes that expose my email’ should also be automatically selected.
  4. Optional. Go to Password and authentication settings.
    1. If needed, setup Passkey or two-factor authentication.

Setup Github Classroom and Codespaces

For workshop attendees, we will use Github Classroom to share files and setup Codespaces. To access the files needed for the workshop, join the After iNaturalist Github Classroom.

  1. Click on the invitation link for After iNaturalist classroom that we emailed to you.

  2. You will see a “Accept the assignment” page. Click “Accept this assignment” button.

This will create a repository in GitHub with code and data for the workshop. The repository will be created in data-explorers-feb-2025 Github account. You will save your work to this repository. Only you and the workshop organizers can access your repository.

  1. You will see a “You’re ready to go!” page. You can open that link in another browser tab or window to view your repository.

    Click “Open in GitHub Codespaces” button.

    This will set up an online development environment where you can write and run code.

  2. You will see page with “Setting up remote connection: Building codespace…” message in the corner. The software for the workshop is being downloaded and installed. This will take about 5 minutes.

    This is Visual Studio Code, the default code editor for GitHub Codespaces. We want to use RStudio as our code editor.

  1. Once the Codespace if finished building, click on the “PORTS” tab at the bottom.

  2. In the PORTS tab, hover over the item named RStudio or 8787. Click on the middle globe icon to start RStudio in a new browser tab.

  3. Now you are ready to write and run R code using RStudio.

  4. Next step is to stop R and Codespace . Follow the steps listed in Stop R and Codespace.

You are done setting up Github. If you have problems, please email us.

Restart Codespace

After the initial setup of Codespace, you can restart an existing Codespace.

  1. Go to data-explorers-feb-2025 Github page, and you should see your repository. Click on your repository.

  2. Scroll to the bottom of the page, and click the “Open in GitHub Codespaces” button. This will restart the Codespace created in the “Setup Github Classroom and Codespaces” section.

  3. This is Visual Studio Code, the default code editor for GitHub Codespaces. We want to use RStudio as our code editor.

  4. Once the Codespace has started, click on the “PORTS” tab at the bottom.

  5. In the PORTS tab, hover over the item named RStudio or 8787. Click on the middle globe icon to start RStudio in a new browser tab.

  1. Now you are ready to write and run R code using RStudio.

    Even though we won’t use Visual Studio Code to write R code, keep the tab for Visual Studio Code open.

Stop Codespace

After you finish your work for the day, you need to stop R, push your code changes to your repository and, stop Codespace.

To stop R, click the orange circle in the upper right of RStudio.

You’ll see a message “R Session Ended”. Close the browser tab for RStudio.

Go to the Visual Studio Code browser tab. Click “bash”. Click “TERMINAL”.

To save the changed files to your repository, type “bash scripts/save_files.sh” after the $, and hit return/enter.

To stop Codespace, click the blue area in the lower left corner of Visual Studio Code.

A popup window will appear. Click “Stop Current Codespace”.

After a little while, you will see a “Codespace is stopped” message. You can now close the browser tab.