Coding basics

R as a calculator

1000/10
## [1] 100

assignment symbol

# A name must start with a letter: can only contain letter, number, _ & .
# The name should be informative

x <- 1000/10

x
## [1] 100

What’s in a name?

Calling functions

function name (arg1 = val1, arg2 = val2 ,…) +

Use of TAB

Hit tab to see a list of options of functions, values, can be used to find info about functions

continuation character, +

Missing part of the code? Console message will show + sign

seq(from = 1, to= 10)
##  [1]  1  2  3  4  5  6  7  8  9 10

Printing to screen

y <- seq(from = 1, to= 10)
y
##  [1]  1  2  3  4  5  6  7  8  9 10