Comparison Operators

Comparison operators: ==, !=, <, >, <=, >=

1==1
## [1] TRUE

Logical operators: AND: &, OR: |, NOT: !

x <- 1:10; y <- 10:1
x > y & x > 5
##  [1] FALSE FALSE FALSE FALSE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE

Basic Calculations

To look up math functions, see Function Index here

x + y
##  [1] 11 11 11 11 11 11 11 11 11 11
sum(x)
## [1] 55
mean(x)
## [1] 5.5
apply(iris[1:6,1:3], 1, mean) 
##        1        2        3        4        5        6 
## 3.333333 3.100000 3.066667 3.066667 3.333333 3.666667



Previous page.Previous Page                     Next Page Next page.