This lesson is being piloted (Beta version)

R for Research: Setup

Setup instructions

R and RStudio

R and RStudio are separate downloads and installations. R is the underlying statistical computing environment, but using R alone is no fun. RStudio is a graphical integrated development environment (IDE) that makes using R much easier and more interactive. You need to install R before you install RStudio. After installing both programs, you will need to install the tidyverse package from within RStudio. Follow the instructions below for your operating system, and then follow the instructions to install tidyverse and RSQLite.

Windows

If you already have R and RStudio installed

If you don’t have R and RStudio installed

macOS

If you already have R and RStudio installed

If you don’t have R and RStudio installed

Linux

For everyone

After installing R and RStudio, you need to install the tidyverse package.

Git

Git is a version control system that lets you track who made changes to what when and has options for easily updating a shared or public version of your code on github.com. You will need a supported web browser (current versions of Chrome, Firefox or Safari, or Internet Explorer version 9 or above).

You will need an account at github.com for parts of this lesson. **Create a GitHub account if you don't have one already.** Basic GitHub accounts are free. You can also get a free GitHub Pro account for education. Use your university email address to create your GitHub account, then apply for an [education discount](https://education.github.com/benefits). Please consider what personal information you'd like to reveal. For example, you may want to review these instructions for keeping your email address private provided at GitHub.

Windows

  1. Download the Git for Windows installer.
  2. Run the installer and follow the steps below:
    1. Click on "Next" four times (two times if you've previously installed Git). You don't need to change anything in the Information, location, components, and start menu screens.
    2. Select “Use the nano editor by default” and click on “Next”.
    3. Keep "Use Git from the Windows Command Prompt" selected and click on "Next". If you forgot to do this programs that you need for the workshop will not work properly. If this happens rerun the installer and select the appropriate option.
    4. Click on "Next".
    5. Keep "Checkout Windows-style, commit Unix-style line endings" selected and click on "Next".
    6. Select "Use Windows' default console window" and click on "Next".
    7. Click on "Install".
    8. Click on "Finish".
  3. To ensure that you can use git with RStudio:
    1. Open RStudio.
    2. In the menu, click on "Tools > Global Options...".
    3. Click on "Git/SVN".
    4. Ensure the checkbox "Enable version control interface for RStudio projects" is selected.
    5. Under "Git executable" click on "Browse".
    6. Navigate to the location of git.exe. This is typically located in "C:\Users\<Your-User-Name>\AppData\Local\Programs\Git\bin".
    7. Click "Open".
    8. Click "OK".

This will provide you with both Git and Bash in the Git Bash program.

macOS

Video Tutorial
  1. For OS X 10.9 and higher, install Git for Mac by downloading and running the most recent "mavericks" installer from this list. Because this installer is not signed by the developer, you may have to right click (control click) on the .pkg file, click Open, and click Open on the pop up window. After installing Git, there will not be anything in your /Applications folder, as Git is a command line program. For older versions of OS X (10.5-10.8) use the most recent available installer labelled "snow-leopard" available here.
  2. To ensure that you can use git with RStudio:
    1. Open RStudio.
    2. In the menu, click on "Tools > Global Options...".
    3. Click on "Git/SVN".
    4. Ensure the checkbox "Enable version control interface for RStudio projects" is selected.
    5. Under "Git executable" click on "Browse".
    6. Navigate to the location of the git executable.
    7. Click "Open".
    8. Click "OK".

Linux

  1. If Git is not already available on your machine you can try to install it via your distro's package manager. For Debian/Ubuntu run sudo apt-get install git and for Fedora run sudo dnf install git.
  2. To ensure that you can use git with RStudio:
    1. Open RStudio.
    2. In the menu, click on "Tools > Global Options...".
    3. Click on "Git/SVN".
    4. Ensure the checkbox "Enable version control interface for RStudio projects" is selected.
    5. Under "Git executable" click on "Browse".
    6. Navigate to the location of the git executable. This is typically located in "/usr/bin".
    7. Click "Open".
    8. Click "OK".

OpenRefine

Data

The data for this lesson is a part of the Data Carpentry Social Sciences workshop. It is a teaching version of the Studying African Farmer-Led Irrigation (SAFI) database. The SAFI dataset represents interviews of farmers in two countries in eastern sub-Saharan Africa (Mozambique and Tanzania). These interviews were conducted between November 2016 and June 2017 and probed household features (e.g. construction materials used, number of household members), agricultural practices (e.g. water usage), and assets (e.g. number and types of livestock).

The data used in this lesson is a subset of the teaching version that has been intentionally ‘messed up’ for this lesson.

Download the data file to your computer by clicking this link. (source link: https://ndownloader.figshare.com/files/11502815)

Software

For this lesson you will need OpenRefine (formerly Google Refine) and a web browser.

Note: this is a Java program that runs on your machine (not in the cloud). It runs inside your browser, but no web connection is needed.

Windows

Mac

Linux