Coding basics

R as a calculator

1 / 200 * 30
## [1] 0.15
#> [1] 0.15
(59 + 73 + 2) / 3
## [1] 44.66667
#> [1] 44.66667
sin(pi / 2)
## [1] 1
#> [1] 1
x <- 3 * 4

assignment symbol

What’s in a name?

Calling functions

Use of TAB

seq(1, 10)
##  [1]  1  2  3  4  5  6  7  8  9 10
x <- "hello world"
y <- seq(1, 10, length.out = 5)
y
## [1]  1.00  3.25  5.50  7.75 10.00
#> [1]  1.00  3.25  5.50  7.75 10.00
(y <- seq(1, 10, length.out = 5))
## [1]  1.00  3.25  5.50  7.75 10.00
#> [1]  1.00  3.25  5.50  7.75 10.00

continuation character, +

Printing to screen