HomeworkFour.Rmd
Read in the surveys.csv daatset. Remove NAs from the datasets.
In this homework, we’re going to explore how different ways of visualizing the same data. First, take a look at geom_col()
. Group the surveys data by the species_id column and count how many of each species there are. Use this count data to make a bar plot of the counts per species.
#Answer here
fct_reorder
. It reorders variables on one or both axes. Try using this to plot the species in order from most to least members.
# Answer here
ggplot(______, mapping = aes(______, fill=____)) +
geom_bar()
geom_bar
accepts various arguments. Try postion="dodge"
or position=“stack”. How does this change the plot and how you interpret it?
#Answer here.
#Answer here.
geom_density
. Density plots are like a smoothed histogram, mostly used for continuous data. But how density is calculated is done using what is called a kernel. To get a sense for what this means, try different kernel types. Some common ones are “triangular”, “rectangular”, and “gaussian.” Try them out, and put the one you think best represents the data in the answer below.ggplot(______, aes(______)) +
geom_density(fill = "blue", binwidth = 10, kernel ="______")
A common set of journal figure requirements several of you submitted include the following:
For each of your plots on the above homework, save figures meeting all requirements in your lastname_directory in a directory called output.
As a longer-term goal, you each picked a few figures. See if you can find the data that the authors used to make the figures. One of the best ways to learn to make good figures in your field is to copy from what’s already published.
What data did the author’s use?
Answer here
Is the data you’re using for class similar to these data?
Answer here
Could you process your data to be similar to these data?
Answer here
Finally, in the final project in this class, you’ll need to produce an R package with five functions:
In next week’s homework, you’ll be expected to pick and write one. So start thinking about one now.