+ - 0:00:00
Notes for current slide
Notes for next slide



First Steps in R

Dr. Mine Dogucu

1 / 16

hello woRld

2 / 16
3 / 16

R review

4 / 16

Object assignment operator

birth_year <- 1950
5 / 16

Object assignment operator

birth_year <- 1950
Windows Mac
Shortcut Alt + - Option + -
6 / 16

R is case-sensitive

my_age <- 2020 - birth_year
My_age
## Error in eval(expr, envir, enclos): object 'My_age' not found
7 / 16

R is case-sensitive

my_age <- 2020 - birth_year
My_age
## Error in eval(expr, envir, enclos): object 'My_age' not found
8 / 16

If something comes in quotes, it is not defined in R.

ages <- c(25, my_age, 32)
names <- c("Menglin", "Mine", "Rafael")
data.frame(age = ages, name = names)
## age name
## 1 25 Menglin
## 2 70 Mine
## 3 32 Rafael
9 / 16

Vocabulary

do(something)

do() is a function;
something is the argument of the function.

10 / 16

Vocabulary

do(something)

do() is a function;
something is the argument of the function.

do(something, colorful)

do() is a function;
something is the first argument of the function;
colorful is the second argument of the function.

11 / 16

Getting Help

In order to get any help we can use ? followed by function (or object) name.

?c
12 / 16

tidyverse_style_guide

canyoureadthissentence?

13 / 16

tidyverse_style_guide

canyoureadthissentence?

age <- c(6, 9, 15)
data.frame(age_kid = age)
14 / 16

tidyverse_style_guide

canyoureadthissentence?

age <- c(6, 9, 15)
data.frame(age_kid = age)

After function names do not leave any spaces.

Before and after operators (e.g. <-, =) leave spaces.

Put a space after a comma, not before.

Object names are all lower case, with words separated by an underscore.

15 / 16

RStudio Setup

16 / 16

hello woRld

2 / 16
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow