All objects in R have a variable type. The most common are:
TRUE
or FALSE
NA
: the object is blank (categorized as logical, but may be part of a character or numeric vector)We can use the class()
function on an object to check its variable type.
class(2000) #numericclass("apple") #characterclass(NA) #logical
R uses symbols to represent:
+
, -
, *
, and /
and follows the order of operations)>
, >=
,<
, <=
, ==
, and !=
)&
, &&
, |
and ||
)<-
or =
)The names of objects in R must follow 3 rules:
.
or _
## Order of operations25+7/4 #26.75(25+7)/4 #8## AND vs OR5 > 3 && 3 > 4 #FALSE5 > 3 || 3 > 4 #TRUE