Answer to (in) equalities are always logical:

100==100+1
## [1] FALSE

Use objects for comparision

apple <-2
pear <- 3
apple == pear
## [1] FALSE
apple != pear
## [1] TRUE

Logical comparisions lke these also work for vectors

nums <- c(10,21,5,6,0,1,12)
nums >5
## [1]  TRUE  TRUE FALSE  TRUE FALSE FALSE  TRUE
which(nums>5)
## [1] 1 2 4 7
any(nums>5)
## [1] TRUE
all(nums <= 10)
## [1] FALSE

Use & for AND; use | for OR

nums [ nums < 20 & nums > 10]
## [1] 12
nums [nums > 10 | nums <5]
## [1] 21  0  1 12

How many numbers are larger than 5?

sum(nums>5)
## [1] 4

Long solution

length(nums[nums>5])
## [1] 4