In reality there is no atomic variable in R. Each variable is a kind of array (list, vector or matrix). However it is still worth to understand the basis elements in R.
To learn a variable's basic type, we could use three ways:
class(var)
mode(var)
typeof(var)
These three are different:
class() shows the class,mode() shows the storage type,typeof() shows the internal type or the storage mode.Missing value is very common in data analysis. And R handles this problem pretty well.
NA represents Not Available, operations with NA result NA. So if we compare an NA to NA, we would get NA.
NA==NA # results NA
To check whether a variable is NA, we could use is.na() to examine whether each element in a vector is an NA.
NaN represents Not a Number. Typically it is result from an ill-formulated equation.
Inf is not a missing value, it represents infinity. It can be used as other number in arithmetic operations, i.e.:
Inf + 1 # is Inf
1/Inf # is 0