This R Notebook is the first introduction to R Notebooks

Scatterplot

This is the scatterplot for the dataset that provides a graphical representation.

plot(mtcars$hp, mtcars$mpg,
xlab= "hp",
ylab= "mpg",
main = "Scatterplot of Horsepower vs MPG.")

With the provided dataset, I created a scatterplot that displays the relationship between mpg (miles per gallon) and hp (horsepower) are correlated. The x-axis represents the horsepower and the y-axis represents mpg.

Bar Chart

Below is a barchart that provides a visual representation of the dataset for the count of cylinders

barchart <- table(mtcars$cyl)
barnames <- names(barchart)
barplot(barchart,
        names.arg = barnames,
        xlab = "Number of Cylinders",
        ylab = "Count",
        main = "Bar Chart of Number of Cylinders")

The barchart displays a visual of the count of cars with the different numbers of cylinders. Each bar represents a category and the height of it is in relation to the count of car in that specific category.

Histogram

Below is a Histogram that is a graphical representation to visualize the distribution of the numerical variable “mpg”.

hist(mtcars$mpg,
     xlab = "Miles per Gallon (mpg)",
     ylab = "Frequency",
     main = "Histogram of the MPG distribution")

This histogram shows the distribution of mpg in the mtcars dataset. This data is distributed more skewed to the right.