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.carb = table(mtcars$carb)
data.labels = names(carb)
share = round(carb/sum(carb)*100)
data.labels = paste(data.labels, share)
data.labels = paste(data.labels,"%",sep="")
pie(carb,labels = data.labels,clockwise=TRUE, col=heat.colors(length(data.labels)), main="Frequency of Carb value")
## The chart below shows that majority of the cars (62%) have 2 or 4 Carbs. Other common carb frequency is 1 (22%), 3/6/8 carbs are very uncommon based on the dataset.
gear type in mtcarsand write a brief summary.gear.type = table(mtcars$gear)
barplot(gear.type, main="No of Gears Frequency", xlab="No. of Gears",ylab="Frequency of Cars",names.arg=names(gear.type),col=c("blue","green","yellow"))
## 3 and 4 gear cars are more common than 5 gear vehicles but there are six 5-gear cars.
gear type and how they are further divided out by cyland write a brief summary.cyl.gear = table(mtcars$cyl, mtcars$gear)
barplot(cyl.gear, main="Frequency of Gears by Cylinder Type in each", xlab="Number of Gears", names.arg= names(gear.type),
cex.names=0.8,
ylab="Number of Cars",
col=c("blue","green","yellow"),
legend = rownames(cyl.gear))
## The graph below shows that most 3 gear cars in the database have 8 cylinders whereas most 4 gear cars have 4 cylineders. Whereas most 5 gear cars have 4 or 8 cylinders.
wt and mpgand write a brief summary.plot(mtcars$wt, mtcars$mpg, main = "Relation between Mileage and Weight of a Car", xlab="Weight (1000 lbs)", ylab="MPG (Miles per Gallon) ", col = "black")
## Based on the data plotted in the graph below, the mileage of a vehicle goes on decreasing as its weight increases. With a few exceptions, a heavier car would mean the mileage on it would be low.
plot(mtcars$hp, mtcars$mpg, main = "Relation between Mileage and Horsepower (hp) of a Car", xlab="HP", ylab="MPG (Miles per Gallon) ", col = "blue")
## The scatterplot of one of the most powerful tool to highligh the relationship between two variables. After looking at the relationship between weight of the vehicles and the mileage, it will be interesting to see the relationship between horsepower and mileage and to find out if there is a sweet-spot that is availble. Looking at the graph, it seems like a range of 150-180 hp is ideally suited is mileage is not to be fully compromised.