Data Carpentry with R

Macquarie University

Dec 11-12 2019

9:00 - 16:30

Instructors: Evan Matthews, Tim Keighley, Fiona Jones

General Information

Data Carpentry develops and teaches workshops on the fundamental data skills needed to conduct research. Its target audience is researchers who have little to no prior computational experience, and its lessons are domain specific, building on learners' existing knowledge to enable them to quickly apply skills learned to their own research. Participants will be encouraged to help one another and to apply what they have learned to their own research problems.

For more information on what we teach and why, please see our paper "Good Enough Practices for Scientific Computing".

Who: The course is aimed at graduate students and other researchers. You don't need to have any previous knowledge of the tools that will be presented at the workshop.

Where: Library M4.02, Macquarie University North Ryde, NSW. Get directions with OpenStreetMap or Google Maps.

When: Dec 11-12 2019. Add to your Google Calendar.

Requirements: Participants must bring a laptop with a Mac, Linux, or Windows operating system (not a tablet, Chromebook, etc.) that they have administrative privileges on. They should have a few specific software packages installed (listed below).

Code of Conduct: Everyone who participates in Carpentries activities is required to conform to the Code of Conduct. This document also outlines how to report an incident if needed.

Accessibility: We are committed to making this workshop accessible to everybody. The workshop organizers have checked that:

Materials will be provided in advance of the workshop and large-print handouts are available if needed by notifying the organizers in advance. If we can help making learning easier for you (e.g. sign-language interpreters, lactation facilities) please get in touch (using contact details below) and we will attempt to provide them.

Contact: Please email swc@mq.edu.au for more information.


Surveys

Please be sure to complete these surveys before and after the workshop.

Pre-workshop Survey

Post-workshop Survey


Schedule

Day 1

Before starting Pre-workshop survey
Morning Project Setup in R
Data organization in spreadsheets
AfternoonOpenRefine for data cleaning
R for Research: Introduction to R
Evening END

Day 2

Morning Continuation of R for Research: data analysis & visualization
AfternoonContinuation of R for Research: data analysis & visualization
Evening Post-workshop survey
END

Syllabus

Open Refine

  • Introduction to OpenRefine
  • Importing data
  • Basic functions
  • Advanced Functions
  • Reference...

Programming in R

  • Working with vectors and data frames
  • Reading and plotting data
  • Creating and using functions
  • Loops and conditionals
  • Using R from the command line
  • Reference...

Version Control with Git, GitHub and RStudio

  • Creating a repository
  • Recording changes to files
  • Viewing changes
  • Working on the web
  • Open licenses
  • Where to host work, and why
  • Reference...

Setup

To participate in a Data Carpentry workshop, you will need access to the software described below. In addition, you will need an up-to-date web browser.

We maintain a list of common issues that occur during installation as a reference for instructors that may be useful on the Configuration Problems and Solutions wiki page.

R

R is a programming language that is especially powerful for data exploration, visualization, and statistical analysis. To interact with R, we use RStudio. The R lessons in this workshop rely on the use of Git. Please follow the instructions below to install the Git software and connect it to RStudio.

Windows

Video Tutorial

Install R by downloading and running this .exe file from CRAN. Also, please install the RStudio IDE. Note that if you have separate user and admin accounts, you should run the installers as administrator (right-click on .exe file and select "Run as administrator" instead of double-clicking). Otherwise problems may occur later, for example when installing R packages.

macOS

Video Tutorial

Install R by downloading and running this .pkg file from CRAN. Also, please install the RStudio IDE.

Linux

You can download the binary files for your distribution from CRAN. Or you can use your package manager (e.g. for Debian/Ubuntu run sudo apt-get install r-base and for Fedora run sudo dnf install R). Also, please install the RStudio IDE.

Data organization in spreadsheets

For this lesson you will need a spreadsheet editor. You may have Microsoft Excel, LibreOffice or a similar software installed already. If so, you do not need to install anything else for this lesson. If you don't have a spreadsheet software installed yet, follow the instructions for your operating system below.

Windows

  1. Download LibreOffice from https://www.libreoffice.org/download/download/
  2. Locate the downloded file and launch the installer.
  3. Follow the on-screen prompts to complete the installation.

Mac

  1. Download LibreOffice from https://www.libreoffice.org/download/download/
  2. Locate the downloded file and launch the installer.
  3. Follow the on-screen prompts to complete the installation.

Linux

  1. Download LibreOffice from https://www.libreoffice.org/download/download/
  2. Locate the downloded file and launch the installer.
  3. Follow the on-screen prompts to complete the installation.

OpenRefine

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

Windows

Check that you have either the Firefox or the Chrome browser installed and set as your default browser. OpenRefine runs in your default browser. It will not run correctly in Internet Explorer.

Download software from http://openrefine.org/

Create a new directory called OpenRefine.

Unzip the downloaded file into the OpenRefine directory by right-clicking and selecting "Extract ...".

Go to your newly created OpenRefine directory.

Launch OpenRefine by clicking google-refine.exe (this will launch a command prompt window, but you can ignore that - just wait for OpenRefine to open in the browser).

If you are using a different browser, or if OpenRefine does not automatically open for you, point your browser at http://127.0.0.1:3333/ or http://localhost:3333 to use the program.

Mac

Check that you have either the Firefox or the Chrome browser installed and set as your default browser. OpenRefine runs in your default browser. It may not run correctly in Safari.

Download software from http://openrefine.org/.

Create a new directory called OpenRefine.

Unzip the downloaded file into the OpenRefine directory by double-clicking it.

Go to your newly created OpenRefine directory.

Launch OpenRefine by dragging the icon into the Applications folder.

Use Ctrl-click/Open ... to launch it.

If you are using a different browser, or if OpenRefine does not automatically open for you, point your browser at http://127.0.0.1:3333/ or http://localhost:3333 to use the program.

Linux

Check that you have either the Firefox or the Chrome browser installed and set as your default browser. OpenRefine runs in your default browser.

Download software from http://openrefine.org/.

Make a directory called OpenRefine.

Unzip the downloaded file into the OpenRefine directory.

Go to your newly created OpenRefine directory.

Launch OpenRefine by entering ./refine into the terminal within the OpenRefine directory.

If you are using a different browser, or if OpenRefine does not automatically open for you, point your browser at http://127.0.0.1:3333/ or http://localhost:3333 to use the program.

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".