Find the mtcars data in R. This is the dataset that you will use to create your graphics.
mtcars data set that have different carb values and write a brief summary.pie(table(mtcars$carb),main='Pie Chart of carb')
# Based on the chart we can see that cars with carb 1, 2 and 4 are the three biggest proportion of the dataset. 3,6 and 8 are just small parts.
gear type in mtcarsand write a brief summary.barplot(table(mtcars$gear),main="Gear Distribution",xlab='Number of Gears')
# Most cars are with 3 or 4 gears while car with 5 gears are relatively small portion of the dataset
gear type and how they are further divided out by cyland write a brief summary.Counts <- table(mtcars$cyl, mtcars$gear)
barplot(Counts,main='Car Distribution by Gears and Cyl',xlab='Number of Gears', col=c("yellow","green",'black'),legend = rownames(Counts))
# For 3 gear cars, most of them carry 8 cylinders. For 4 gear cars, most of them carry 4 cylinder. For 5 gear cars, the chance to got 4 cylinders or 8 cylinders are roughly the same
wt and mpgand write a brief summary.plot(mtcars$wt, mtcars$mpg, main="Scatterplot of wt and mpg",
xlab="Car Weight ", ylab="Miles Per Gallon ", pch=19)
# Their is a negative relationship between car weight and MPG. The more the car weights, the lower the MPG it will has.
plot(mtcars$hp, mtcars$mpg, main="Scatterplot of hp and mpg",
xlab="Horse Power ", ylab="Miles Per Gallon ", pch=20)
# This scatterplot shows the relationship between horse power of the car and MPG. So basically most of the environmental friendly cars are the ones which have lower house power.