ABSTRACT

R uses several basic data types that are frequently used in most R functions or calculations. Here we list the most fundamental data type objects:

A vector can be either numeric, complex, a character vector, or a logical vector. These vectors correspond to a sequence of numbers, complex numbers, characters, or logical values, respectively.

An array is a vector with a dimension attribute, where the dimension attribute is a vector of non-negative integers. If the length of the dimension vector is k, then the array is k-dimensional. The most commonly used array is a matrix, which is a two-dimensional array of numbers.

A factor object is used to define categorical (nominal or ordered) variables. They can be viewed as integer vectors where each integer value has a corresponding label.

A list is an ordered collection of objects. A vector can only contain elements of one type but a list can be used to create collections of vectors or objects of mixed type.

A data frame is a list of vectors or factors all of the same length such that each “row” corresponds to an observation.