Load built-in dataset

data(mtcars)

mtcars # First rows of the dataset head(mtcars)

Last rows

tail(mtcars)

Structure of the dataset

str(mtcars)

Summary statistics

summary(mtcars)

Dimensions of the dataset

dim(mtcars)

Column names

names(mtcars)

Access a single column

mtcars$mpg

Mean of miles per gallon

mean(mtcars$mpg)

Frequency table of cylinders

table(mtcars$cyl)

Histogram

hist(mtcars$mpg, main = “Histogram of MPG”, xlab = “MPG”)

Boxplot

boxplot(mtcars$mpg, main = “Boxplot of MPG”)

Scatter plot

plot(mtcars\(wt, mtcars\)mpg, main = “MPG vs Weight”, xlab = “Weight”, ylab = “MPG”)

Final Comments

This activity helped me explore and better understand a real dataset using R. By examining the structure, summary statistics, and visualizations, I was able to see how data exploration helps identify patterns and relationships between variables. These steps are essential before applying more advanced data analysis or machine learning techniques.