# Create a scatterplot of the relationship between horsepower and miles per gallon

Posted: September 22nd, 2022

**Place your order now for a similar assignment and have exceptional work written by our team of experts, At affordable rates**

**For This or a Similar Paper Click To Order Now**

Instructions.

• Use R Markdown to create a PDF document with the two tasks.

• As always, any plots should have appropriate axis and overall labels.

1. There is a data set in R called mtcars.

(a) Is mtcars a data frame or a matrix? If it is not a data frame, make it one using data.frame().

(b) Access the help file on mtcars and summarize the brief descriiption of the data set.

(c) Of the variables in mtcars all are of class numeric. That said, are there any that it would make sense to call categorical? Which ones and why?

2. Create a scatterplot of the relationship between horsepower and miles per gallon (vertical axis). Add a linear regression line to the plot and describe the relationship in words in context. Do this in both base R and ggplot2.

(a) Make a conditional violin plot with superimposed boxplots in ggplot2 of miles per gallon conditional on transition type (automatic or not). Interpret the plot in context.

(b) Use factor() to add factor versions of the variables gear and cyl. Create dodged and stacked bar charts in ggplot2. For your stacked bar charts, look up how to normalize the bars so that they equal 100% and do that. Interpret the results in context.

(c) Use mtcars data to create a scatterplot that pulls in multivariate information like we did with the state abbreviations and regions in class. Surprise me.

**For This or a Similar Paper Click To Order Now**

*Related*