STATS 32: Introduction to R for Undergraduates

Damian Pavlyshyn

April 6, 2020

http://web.stanford.edu/class/stats32/lectures/

Welcome to STATS 32!

About me: Damian Pavlyshyn

Zoom etiquette (subjecct to change as we figure this out)

What is R?

What are it’s strengths?

print("Hello, world!")
## [1] "Hello, world!"

What are you better off finding elsewhere?

Administrative details

Structure of the course

Before the session

During the session

After the session

Fun R stuff

R-bloggers

Blog aggregator of content contributed by bloggers who write about R

The R Journal

Bi-annual open-access journal: Features short to medium length articles covering topics of interest to R users and developers

R-exercises

Website with both tutorials and exercises

DataCamp

Website for learning data science, R included (some courses free, some not)

Using RStudio

Rmarkdown

What is a variable?

x <- 3
x <- 3
x <- 3
y <- "abc"
x <- 3
y <- "abc"
x <- 3
y <- "abc"
y <- 5
x <- 3
y <- "abc"
y <- 5
x <- 3
y <- "abc"
y <- 5
x <- y
x <- 3
y <- "abc"
y <- 5
x <- y
x + y   # 5 + 5 = 10

Variable types

Confusion: 123 vs. “123”

How to differentiate between numeric variables and character variables which consist of digits?

Let’s get our hands dirty!

Today’s dataset: Uber and Green taxi trips in New York

Some questions