
10 R Programming for Bioinformatics
represent a form of contiguous storage (character vectors are an exception).
R has six basic vector types: logical, integer, real, complex, string (or charac-
ter) and raw. The type of a vector can be queried by using one of the three
functions mode, storage.mode or typeof.
> typeof(y)
[1] "double"
> typeof(is.na)
[1] "builtin"
> typeof(mean)
[1] "closure"
> mode(NA)
[1] "logical"
> storage.mode(letters)
[1] "character"
There are also a number of predicate functions that can be used to test
whether a value corresponds to one of the basic vector types. The code chunk
b elow demonstrates the use of several of the predicate