R Vectors
kodingwindow@kw:~$ R
...
> c(1,2,3)
[1] 1 2 3

> c(1,2,3) + 10
[1] 11 12 13

> c(1,2,3) - 10
[1] -9 -8 -7

> c(1,2,3) + c(3,2,1)
[1] 4 4 4

> vector = c(1,2,4,5,9,-1.1)
> vector
[1]  1.0  2.0  4.0  5.0  9.0 -1.1

> vector = 1:10
> vector1 = 1:10
> vector2 = 10:9
> vector1 + vector2
 [1] 11 11 13 13 15 15 17 17 19 19

> print(c(T,T,F,F,T))
[1]  TRUE  TRUE FALSE FALSE  TRUE

Comparing integers > c(1:5) == 5 [1] FALSE FALSE FALSE FALSE TRUE > c(1:5) ^ 2 [1] 1 4 9 16 25 > c(1:5) ^ 2 >= 5 [1] FALSE FALSE TRUE TRUE TRUE
Advertisement