Types of Data Objects in R Programming

Joanna
3 min readSep 5, 2021

R has many data structures includes vector, list, matrix, data frame, and array. This article introduces each of them.

From a high level, it can be summarized as follows:

For data objects, R provides a few functions to check their features. For example,

  • typeof() — what data type is it?
  • length() — how long is it?
  • attributes() — does it have any metadata?

Atomic Vectors

Atomic vectors include six basic data types. They are

A vector requires all the members are in the same data type.

Lists

A list allows different data types, therefore, lists in R are also called generic vectors. You can create a list using list() , and as.list() to coerce an object to a list.

Matrix

Matrix is a special array. An array can store multiple dimensions of data, while a matrix…

--

--

Joanna

Data Product @ TikTok | Adjunct Professor of Data Science | Python, R, ML, DL