Chapter 4 The Basics
4.1 R can be our calculator
Addition (use +
).
[1] 4
Multiplication (use *
).
[1] 12
Division (use /
).
[1] 50
…anything is possible
[1] 0.3252033
💡 Type in your numbers either within the workshop.R file (TOP-RIGHT) or within the console (BOTTOM-RIGHT). Then to run - click Run at the top of the .R script or type ctrl/cmd
+ enter
. The answer prints in the console.
4.2 R can be our notebook
We can save important information for later.
We can use <-
or =
[1] "My name is Caitlin"
[1] "My name is Caitlin" "My name is Dionne" "My name is Lauren"
[1] 16440
[1] 1.141667
[1] 394
💡 Students are encouraged to make their own variable names and get used to R coding symbols