Skip to content

Introduction to R for Data Analysis

Natalie Elphick edited this page Mar 2, 2023 · 30 revisions

Description

The scripting language R is considered one of the most powerful languages for quantitative analysis, statistics, and graphics. This workshop will help you get started using R to analyze your datasets and create graphs for visualization. You'll do hands-on exercises to demystify data analysis using R. This workshop is designed for those who have no background whatsoever in programming/R.


Part 1: The R language and RStudio

  • What is R and why should you use it?
  • The RStudio interface
  • Troubleshooting error messages
  • Variables
  • Types & data structures
  • Math and logic operations
  • Functions and packages
  • Reading data into R

Part 2: Hands-on Data Analysis in R

  • Filtering and reformating data
  • Exploring data (Basic summaries such as mean, median, etc.)
  • Plotting data
  • R markdown report generation

No background in statistics or computing is necessary. Bring your laptop with RStudio and R installed.

Learning Path

Novice   This is an introductory workshop in the R Scripting series. No prior experience with programming or R/RStudio is required for this course. No prerequisites. Absolute beginners are especially welcome!

Materials

Click here to download the workshop materials or click here to access individual files.

Pre-workshop Instructions

Before the workshop, follow the instructions in sections 1.1 and 1.2 on this page to install R and RStudio on your computer.

Online Learning

You can access these materials remotely at any time and go through them at your own pace. Here's how:

  1. Download the materials and unzip the contents.

  2. Inside the downloaded folder is a slide deck that describes some of the essential terms and concepts. Please go through these and practice the commands on the slides in RStudio. Note that direct copying from slides to RStudio may result in errors because of formatting differences. The commands on the slides are also available in R scripts (also inside the downloaded folder) with relevant explanations.

Additional recommended materials for online learning

  1. UCSF library provides an excellent Intro to R module in its Collaborative Learning Environment. It has an instructional video to get started with RStudio, descriptive text, and exercises for practice. All of it is available in a user-friendly online environment. We highly recommend checking this out!

  2. Software carpentry provides well-organized content to get started with R. See here. Absolute beginners may want to focus on modules 1-11 and go through them in two or three sessions.

  3. A searchable list of RStudio webinars and conference talks

  4. Free online books:
    Beginner:
    Hands-on programming with R
    Intro to R
    Intermediate:
    R for Data Science
    ggplot2: elegant graphics for data analysis
    Advanced:
    Advanced R