Skip to Main Content

R for Beginners

Guide for the workshop R for Beginners - introducing basic R concepts and how to use R for data wrangling, analysis, and visualization

Pre-survey & Workshop Evaluation

Please fill out the pre-survey and evaluation to help us understand your expectations and thoughts about the workshops.

Session 1: Introduction to R and RStudio

Session 1: Introduction to R and RStudio

Content Covered

  1. R and RStudio Installation

  2. More about RStudio - interface, projects, working directory

  3. Vectors and functions

Details

Installation for PC
  1. Download R from https://cloud.r-project.org/bin/windows/base/
  2. Download RStudio at https://posit.co/download/rstudio-desktop/#download
Installation for Mac
  1. Check your version number and make sure to download the correct version of R/RStudio.

  2. Download R from https://cloud.r-project.org/bin/macosx/, and select the .pkg link based on your macOS version.

  3. Download RStudio at https://posit.co/download/rstudio-desktop/#download

R & RStudio Installation Guidance
 
Relevant Links

Common Shortcuts in RStudio

Windows /Linux

Mac

Run current command/selection

Ctrl+Enter

Cmd+Enter

Show shortcuts

Alt+Shift+K

Option+Shift+K

Insert <-

Alt+-

Option+-

Comment lines

Ctrl+Shift+C

Cmd+Shift+C

Insert code section

Ctrl+Shift+R

Cmd+Shift+R

Insert %>%

Ctrl+Shift+M

Cmd+Shift+M

Session 2: Starting with Data

Session 2: Starting with Data

Content Covered

  1. Data frames and tibbles

  2. Data SAFI

  3. R packages

  4. Missing data

Details

About the Dataset

The data used for this lesson are in the figshare repository at: https://figshare.com/articles/SAFI_Survey_Results/6262019

This lesson uses SAFI_clean.csv. The direct download link for this file is: https://raw.githubusercontent.com/datacarpentry/r-socialsci/main/episodes/data/SAFI_clean.csv

Session 3: Data Wrangling with dplyr and tidyr

Session 3: Data Wrangling with dplyr and tidyr

Content Covered

  1. Select rows and/or columns from a data frame
  2. Combine multiple commands into a single command
  3. Create new columns and remove existing columns from a data frame
  4. Wide vs long format of dataframes
  5. Reshape a data frame between its wide and long formats
  6. Export a data frame to a csv file

Session 4: Data Visualization with ggplot2

Session 4: Data Visualization with ggplot2

Content Covered

  1. Fundamental elements of a ggplot graphic
  2. Create scatterplots, boxplots, and bar charts
  3. How to create multiple plots at once
  4. How to use copilot to help you improve coding skills

Books about R and R Programming