Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due
Stat 470/670 Homework 3
Submit exactly two files: (i) a PDF/HTML file with your write-up and graphs and (ii) a .r/.txt/.Rmd file with code to reproduce your results.
1. Create a histogram on the diamonds dataset, for example with ggplot() + geom_histogram(aes(x = carat), data = diamonds) Re-write this using the layer function like we did in class. Hint: if you don’t know what the default values for some of the aspects of the plot, examine p$layers
2. Remember that a histogram is a plot with stat_bin and geom_bar. Modify your histogram code so that it uses a different geom, for example geom_line or geom_point. This should be simple once you have the layer specification of a histogram.
3. In your histogram (the one plotted with bars that you created in question 1), add an aesthetic mapping from one of the factor variables (maybe color or clarity) to the fill or color aesthetic.
4. What is the default position adjustment for a histogram? Try changing the position adjustment in the histogram you created in question 3 to something different (hint: try dodge).