hist(x, ...)Graphs are helpful for presenting a summary of data and results of a statistical analysis
John W. Tukey, the father of exploratory data analysis once said
The greatest value of a picture is when it forces us to notice what we never expected to see.
The function hist() is used to obtain a histogram of a quantitative variable
Syntax of hist()
x is a quantitative vectorhist():
xlab, main, probability, etc.(use mtcars data frame to answer the followings)
Create a histogram of mpg with appropriate labels
Add density line to the plot obtained in Question 1.
Boxplot is a useful graphical tool that can be used to compare distribution of a quantitative variable at different levels of a qualitative variable
boxplot() function can be used for both univariate and bivariate analysis
boxplot(x) is used to obtain a boxplot of a single quantitative vector x
boxplot(formula, data) function is used for a bivariate analysis, where the formula species the quantitative and qualitative variables of interest
formula = quant_var ~ qual_var
data is a data frame that must contain quant_var and qual_var
(use mtcars data frame to answer the followings)
Create a boxplot of qsec with appropriate labels.
Create a boxplot of mpg to compare its distribution at different levels of cyl
The function plot(x, y) is used to obtain a scatter plot of two quantitative variables x and y
Some useful arguments of plot() function
xlab, ylab, main
pch (point type)
cex (size of points), etc.

lm() is for fitting a linear model(use mtcars data frame to answer the followings)
Create a scatter plot to examine the association between mpg and disp
Add the fit of a linear regression model mpg on disp to the plot obtained in Question 6
Bar chart is used to examine the distribution of a qualitative variable
The function barplot(height, ...) is used to obtain a bar chart in R, where height represents a frequency
table() function takes a qualitative variable as an argument and returns height, the frequency corresponding to each level of the qualitative variable
species(use mtcars data frame to answer the followings)
cylThe function par() has many arguments that can be used to produce high-quality graphs using base R plot functions
mfrow argument of par() is used to split a figure layout into a number of rows and columns
mfrow = c(2, 3) will split the figure layout into two rows and three columnsDistribution of bill_length_mm at different levels of species
