
Your Success, Our Mission!
6000+ Careers Transformed.
A matrix is a two-dimensional data structure that stores elements of the same data type, arranged in rows and columns.
Creating a Matrix
| m <- matrix(1:6, nrow = 2, ncol = 3) |
By default, R fills matrices column-wise.
Accessing Matrix Elements
| m[1, 2] # Row 1, Column 2 |
Matrix Operations
| m * 2 # Scalar multiplication |
Matrix multiplication:
| a <- matrix(1:4, nrow = 2) b <- matrix(5:8, nrow = 2) a %*% b |
Key Points
What is a List?
A list is a flexible data structure that can store different types of data together.
Creating a List
| my_list <- list( name = "R Programming", version = 4.3, active = TRUE, scores = c(80, 90, 85) ) |
Accessing List Elements
| my_list$name my_list[[2]] |
Why Use Lists?
Key Points
Elements can be of different data types
Can contain vectors, matrices, data frames, and even other lists
Very powerful and flexible
What is a Data Frame?
A data frame is the most commonly used data structure in R for data analysis. It is similar to a table where:
Creating a Data Frame
| students <- data.frame( name = c("A", "B", "C"), age = c(20, 21, 22), score = c(85, 90, 88) ) |
Accessing Data Frame Data
| students$name students[1, ] students[, 2] |
Basic Data Frame Functions
| head(students) str(students) summary(students) |
Why Data Frames are Important
Comparison of Data Structures
Data Structure | Dimensions | Data Type | Common Use |
| Vector | 1D | Same | Basic data storage |
| Matrix | 2D | Same | Mathematical operations |
| List | Any | Different | Complex data storage |
| Data Frame | 2D | Different | Data analysis |
Top Tutorials
CNN in Deep Learning 2026
A beginner-friendly guide to CNNs: understand deep learning essentials, create Python-based models, and explore advanced applications.
Breaking The Limits: Scaling Databases with MySQL Partitioning
Learn MySQL partitioning with examples. Improve query performance, scalability, and data management using RANGE, LIST, HASH, KEY, and composite techniques.
ML in Action: Hands-On Guide to Deploying and Serving Models
Learn model deployment and serving—from concepts to real-world architectures, tools, APIs, containers, and cloud workflows for production-ready ML.
All Courses (6)
Master's Degree (2)
Fellowship (2)
Certifications (2)