ENV 872 - Coding Workspace Setup

ENV 872 - EDA   |   Spring 2024   |   Instructors: Luana LimaJohn Fay  |  

To complete the course exercises and assignments, you will need access to a machine with specific software installed. These include R, RStudio, and Git, and you have a few options on how to access these applications.

Option 1: Using an RStudio Container

Duke provides a set of containers for its affiliates to use. A “container” is a web-based resource pre-configured to run all the software you need, but only that software. RStudio and Git will work and appear just as they would on a typical desktop machine, but there’s no real operating system outside those applications to interact with. The advantage of these containers, however, is that you can access them via a web browser from anywhere, and when you do access it, your session picks up right where you left off.

Creating your RStudio Container

  1. Navigate to Duke’s Container Manager: https://cmgr.oit.duke.edu/containers. (You’ll be required to log in.)
  2. In the “Reservations Available” column of the Container Manager, find the option to “reserve RStudio” and click it. The RStudio Container should now appear on the left hand column called “My reservations”.

That’s it! Your container has been created and is ready to use. The instructions below outline the simple steps how to access your container.

Accessing your RStudio Container

As mentioned above, you can access your container from any machine with an internet connection and a web browser (yes, even your phone, but that might be a bit awkward to work with…). Here’s what you need to do:

  1. Navigate back to Duke’s Container Manager: https://cmgr.oit.duke.edu/containers (if you aren’t there already).

  2. Click the RStudio link in the “My Reservations” column. The “Container Controls” window will appear with a blue “Login” button. Click that button.

  3. The page will update to show the “Start” button. Press that and RStudio will open. It may take a moment, but it should appear.

    :point_right:Pro tip: Create a shortcut that takes you directly to your RStudio container by bookmarking https://cmgr.oit.duke.edu/containers/rstudio

Ending your RStudio Session

  1. Just close the web page!

    Yep, that’s all you need to do. When you re-open your container, it should go right back to where you left off. Of course, you’d be wise to save any files, and as we’ll show soon enough, back them up using Git & GitHub.


Option 2: Using a Personal Machine

Using the RStudio Container is the preferred option from our point of view: the configuration is known to us, and we can help debug any issues that arise. However, you may insist on using your own personal machine, and we are ok with that. The software we use is free and works on all platforms: Windows, Macs, and Unix-based machines, and you don’t even need a lightning-fast machine to install the software or run the exercises we’ll be doing in class. However, if something goes wrong with your installation, we can’t guarantee we can debug it, since the issue may be a conflict with your machine’s unique configuration.

Installing R & RStudio

  1. Navigate to https://posit.co/ and click “Download RStudio”. This will take you to the downloads page.

  2. Click any of the many “Download RStudio” buttons on the page that appears to take you to the RStudio Desktop download page.

  3. Click the button to Download and Install R which will open a page in a new tab. This page includes links to install R.

    • Select the version appropriate to your machine and follow the instructions provided.

    • Once R is installed you are ready to install RStudio.

    :point_right:Why do we need to install both R and RStudio?

    R is the engine that will do all our data analysis, but to use it, we’d have to enter commands at command prompt which isn’t very fun or efficient. RStudio is an interface to R, sometimes described as the “car” that allows us to drive places with the R engine. It makes coding with R much, much easier.

  4. Back on the Download RStudio Desktop web page and download and run the RStudio installer appropriate for your machine.

Installing Git

  1. Open a web browser and navigate to https://git-scm.com/download/
  2. Select and follow the appropriate installer instructions for your operating system (Windows, Mac, Linux).
  3. Open the installer and follow the onscreen directions.
  • On Mac:
    You will need to make sure you have Xcode Command Line Tools installed. To test this, type which g++ into Terminal. If you get /usr/bin/g+ as a reply, then you are ready to move on.
    For Git options when installing, we recommend “Checkout as-is, commit Unix-style line endings”.
  • On Windows:
    Use all the of the installation defaults.

You should now have all the technology you need to run the course lab exercises and assignments. Additionally, through our use of Git and GitHub, you can fairly easily switch across different computing platforms, as long as they have these three elements installed. So if you run into any serious issues, you should have whatever workarounds you need to continue your work seamlessly.