Due–next Friday, not next Monday.
The point of this week is to get experience plotting, but also to dip your toe into the process of reproducible research through coding. So don’t turn in your responses as images this time, but as the commands you run to make the plots.
In the handout, we made a histogram of “year”. Make one of month. What month (they are numbered in the data set) do the most whaling voyages leave in? The least?
Here’s a list of all the variables in the shipping dataset. Make a histogram of something else.
[1] "LastName" "FirstName" "Rig" "Age" "Skin" "Hair" "Eye"
[8] "Residence" "Rank" "Voyage.number" "VesselNumber" "height" "date" "year"
[15] "month" "decade"
ggplot(ships) + aes(x=year,fill=Rig) + geom_bar()
facet_wrap
or facet_grid
small multiple topic that works better than the ones described.5.Here’s just a little optional brainteaser. Run each of these charts in turn, and see if you can figure out what’s going in the progression. What is different about each one in turn? What kind of barchart is the third one? (You can type ?coord_polar
to get a description of the latter case.)
ggplot(ships) + aes(x=factor(1),fill=Rig) + geom_bar(width=1)
ggplot(ships) + aes(x=factor(1),fill=Rig) + geom_bar(width=1) + coord_polar()
ggplot(ships) + aes(x=factor(1),fill=Rig) + geom_bar(width=1) + coord_polar(theta="y")