# Introduction to R: Getting started with R and RStudio

Hosted by the Carnegie Mellon University (CMU) Libraries

## About this Workshop

This 2-part introductory workshop aims to teach basic concepts, skills, and tools for working with data in R so that you can get more done in less time, and apply concepts of reproducibility to your research. This is an introduction to R designed for participants with no programming experience. Part 1 of the workshop covers basic information about R syntax and the RStudio interface, including installing packages and working with vectors. Part 2 will cover importing CSV files, working with dataframes, how to deal with factors, how to add/remove rows and columns using the popular dplyr package, and how to calculate summary statistics from a data frame. Taking Part 1 and Part 2 is encouraged, but optional.

Learners should bring a laptop and should already have installed R and RStudio on their computer. *__*

### Presenters

Sarah Young

Principal Librarian

Office: 109G, Hunt Library

sarahy@andrew.cmu.edu

### Goals of this Workshop

#### Part 1

- Describe the different panes in the RStudio environment and how they are used when coding in R.
- Run lines of R code from a script file to the console.
- Create and store new objects in R.
- Find help information for functions.
- Use functions in R with appropriate syntax and arguments.
- Define, create and manipulate vectors in R.

#### Part 2

- Install packages and load libraries in R.
- Import a dataset and use tidyverse functions to explore dataset attributes.
- Create subsets of dataframes.
- Work with categorical variables in R.
- Use the dplyr package to select columns and filter rows.
- Use the dplyr package to perform various operations on a dataframe such as creating new variables, splitting and combining data, and summarizing data.
- Use pipes in R to string together a series of steps.
- Export a data set from R Studio.

## Schedule TBD

### Slides

*Click on the slides then press CTRL+Shift+F for full screen.*

### Workshop assessments

Pre-workshop survey

Post-workshop survey

### Acknowledgements

The lesson materials and slides for this workshop were largely adapted from the Data Carpentries lesson “R for Social Scientists”. Content was adapted and reformatted for the CMU Libraries workshop series by Patrick Campbell.