Coding basics

R as a calculator

1000 / 10
## [1] 100

assignment symbol

#object_name <- value
# Short cut = option + - (minus sign)
x<- 1000/10
x
## [1] 100

What’s in a name?

#R is sensitive. The objects name needs to start with a letter, it can only contain letters, numbers, _ and . 
# When printing the name, make sure it is spelled correctly. 

Calling functions

Use of TAB

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

continuation character, +

seq(from = 1, to = 10)
##  [1]  1  2  3  4  5  6  7  8  9 10
#If the last parentency were missing, R would show + as a symbol, to indicate that it is missing value

Printing to screen

y <-seq(from = 1, to = 10)
#When saving a code to a name, R won't print the result. Type the saved name bellow to print. 
y
##  [1]  1  2  3  4  5  6  7  8  9 10
#Or souround the calling function with a ()
(y <-seq(from = 1, to = 10))
##  [1]  1  2  3  4  5  6  7  8  9 10