MATH 315 Homework 03
Due 2025-09-19 by 11:59pm
- Create a dataset named
donkeys
with the following code
donkeys <- read.csv("https://raw.githubusercontent.com/roualdes/data/refs/heads/master/donkeys.csv")
-
Read about the donkeys dataset from the online help file
-
Pick a variable of your choice, or create one, and make a bar chart using
ggplot2
. Change the axis labels if you think it appropriate. Put a title on the plot. -
Pick a variable of your choice and make a histogram using
ggplot2
. Change the x-axis label being sure to include the correct units. -
Describe your histogram in at least two English sentences using new words from class.
-
Pick two variables of your choice and make a scatter plot. Change the axis labels being sure to include the correct units.
-
Describe your scatter plot in at least two English sentences using new words from class.
-
Pick two variables of your choice and make a box plot (which should include more than one "box"). Change the appropriate axis label being sure to include the correct units.
-
Describe your box plot in at least two English sentences using new words from class.
-
Make a plot that includes one more variable than is standard for the plot type of your choice. For instance, if you choose to make a bar chart, then you should use two variables. If you choose to make a scatter plot, then you should use three variables.
If you finished Homework 03 early and want some extra practice problems that are worth 0 points. You do not need to do these, if you don't want.
-
Instead of histograms, sometimes people prefer a smoothed histogram that doesn't require a choice of bins/bin width to be made. Such a smoothed histogram is a density plot and is created with the ggplot2 geometry
geom_density()
. Mimic your histogram from above. Specify the argumentcolor
, insideaes(...)
, to be equal to a categorical variable. Describe your density plot in at least two English sentences using new words from class. -
Recreate your scatter plot from above. Specify the argument color to color the points by a categorical variable of your choice. Add the geometry
geom_smooth(method="lm", se = FALSE)
. To make your plot look better:- explore different plot themes
- try specifying the argument
alpha
to thegeom_point()
geometry to be any decimal between 0 and 1 - try following this tutorial to change the default color choices; pay attention to the name of the color palettes and the sub-section Customizing discrete data color/fill mappings: Using a colorbrewer scale.
Describe your scatter plot in at least two English sentences using new words from class.