So far, we've only been dealing with numerics, but there are other atomic data types in R:
> foo <- TRUE # foo is of the logical data type > class(foo) # class() tells us the type  "logical" > bar <- "hi!" # bar is of the character data type > class(bar)  "character"
The logical data type (also called Booleans) can hold the values TRUE or FALSE or, equivalently, T or F. The familiar operators from Boolean algebra are defined for these types:
> foo  TRUE > foo && TRUE # boolean and  TRUE > foo && FALSE  FALSE > foo || FALSE # boolean or  TRUE > !foo # negation operator  FALSE
In a Boolean expression with a logical value and a number, any number that is not 0 is interpreted as TRUE: