# Statistics for Data Science R Code Guide

*2021-09-26*

# Preface

This guide provides details and examples on using R to perform the kinds of statistical analyses that we’ll use in STAT 255. You may use it as a template, as you write code for your assignments.

## 0.1 Installing R and RStudio

If you want to work with R from your own computer, you can install it for free using the directions below. This will allow you to work on your assignments whenever and wherever you would like.

### 0.1.1 Installing RStudio

- To install R, click the link.
- Choose the version appropriate for your system.

- Download R version 4.1.1.

Mac:

Windows:

- Install R version 4.1.1 on your computer.

### 0.1.2 Installing R Studio

- To install R Studio, click the link.
- Download the version of RStudio Desktop appropriate for you. This is suggested in step 2.

- Install RStudio on your computer.

The following chapters walk you through the important tasks you’ll perform in this class. I will continue to add to this document as the course progresses.

### 0.1.3 Using R on Lawrence’s Lab Computers

R is also installed in many computer labs on campus, including Briggs 421. If using R from a computer lab, be sure to work from the desktop version. Be aware that there is also a browser version of RStudio at Lawrence (Rstudio.lawrence.edu), which you may have used in other classes. We will NOT use this version in this class. It is not updated as frequently, and is ill-equipped to handle the kind of computations we will need to perform in this class.