Data Structures

🧺 R’s Data Structures help you organize and analyze different types of data, from single values to entire datasets.

Vector

A one-dimensional collection of elements of the same type.

List (list)

A list can hold elements of different types — including other structures.

Matrix (matrix)

A 2D structure of elements, all of the same type.

Data Frame (data.frame)

Tabular data with named columns, which can be of different types.

Factor (factor)

Used to store categorical data with predefined levels.

Common Errors

Some frequent mistakes when working with R Data Structures: