HW 04 - Potpourri

Due: 27 November, 16:00 UK time

Image by PublicDomainPictures from Pixabay Image by PublicDomainPictures from Pixabay

In this three part assignment you get to practice what we learned this week, try something new, and get creative!

NOTE: No automated checks for this homework assignment! Make sure to knit and commit and push your Rmd, output, and any figures you generate.

Need a refresher of the workflow?

For each assignment in this course you will start with a GitHub repo that I created for you and that contains the starter documents you will build upon when working on your assignment. The first step is always to bring these files into RStudio so that you can edit them, run them, view your results, and interpret them. This action is called cloning.

Then you will work in RStudio on the data analysis, making commits along the way (snapshots of your changes) and finally push all your work back to GitHub.

Next, get the URL of the repo to be cloned, go to RStudio Cloud and navigate to the course workspace via the left sidebar, and clone the repo. If you would like to step-by-step instructions with screenshots, please review HW 00.

Tired of typing your password?

Chances are your browser has already saved your password, but if not, you can ask Git to save (cache) your password for a period of time, where you indicate the period of time in seconds. For example, if you want it to cache your password for 1 hour, that would be 3,600 seconds. To do so, run the following in the console, usethis::use_git_config(credential.helper = "cache --timeout=3600"). If you want to cache it for a longer amount of time, you can adjust the number in the code.

Part 1 - Mirror, mirror on the wall,

who’s the ugliest of them all?

Here is a simple plot using the mpg dataset, which contains information on fuel economy of cars. We’re plotting highway miles per gallon vs. city miles per gallon, coloured by whether the car is front-wheel drive, rear wheel drive, or four-wheel drive.

ggplot(data = mpg, aes(x = cty, y = hwy, color = drv)) +
  geom_point()

I realize that “ugly” is subjective, so we’re mostly looking to see if you can figure out how to change the look of a plot using help files of functions you haven’t learned before.

  1. Make this plot as ugly as possible by changing colours, background color, fonts, or anything else you can think of. You will probably want to play around with theme options, but you can do more. You can also search online for other themes, fonts, etc. that you want to tweak. Try to make it as ugly as possible, the sky is the limit!

Part 2 - You gotta pick a package or two

But really, one is enough. Pick a package from the list below, and use it to do something. If you want to use a package not on this list, that’s also ok, but it needs to be a package we haven’t used in class. If you start with a package and are struggling to get it to work, ask for help on Piazza or just move to another one.

Remember, you install the package in the Console, not in your R Markdown document since you don’t want to keep reinstalling it every time you knit the document.

Your task is to install the package you pick. Depending on where the package comes from, how you install the package differs:

Then, load the package. Regardless of how you installed the package you can load it with the library function.

Finally, do something with the package. It doesn’t have to be complicated. In fact, keep it simple. The goal is for you to read and understand the package documentation to carry out a simple task.

  1. Which package are you using? State the name of the package, whether it was on CRAN or GitHub, and include the code for loading it. Also include a one sentence description of what the package does.Then, do something with the package and provide a brief narrative including code and output. Also comment on difficulties you had, if any, figuring out how to use the package.

Packages on CRAN

These packages can be installed with:

install.packages("PACKAGENAME")
Package Description
cowsay Allows printing of character strings as messages/warnings/etc. with ASCII animals, including cats, cows, frogs, chickens, ghosts, and more
babynames US Baby Names 1880-2015
dragracer These are data sets for the hit TV show, RuPaul’s Drag Race. Data right now include episode-level data, contestant-level data, and episode-contestant-level data
datapasta RStudio addins and R functions that make copy-pasting vectors and tables to text painless
DiagrammeR Graph/Network Visualization
janeaustenr Full texts for Jane Austen’s 6 completed novels, ready for text analysis. These novels are “Sense and Sensibility”, “Pride and Prejudice”, “Mansfield Park”, “Emma”, “Northanger Abbey”, and “Persuasion”
ggimage Supports image files and graphic objects to be visualized in ‘ggplot2’ graphic system
gganimate Create easy animations with ggplot2
gt Easily Create Presentation-Ready Display Tables
leaflet Create Interactive Web Maps with the JavaScript ‘Leaflet’ Library
praise Build friendly R packages that praise their users if they have done something good, or they just need it to feel better
plotly Create interactive web graphics from ggplot2 graphs and/or a custom interface to the JavaScript library plotly.js inspired by the grammar of graphics
suncalc R interface to suncalc.js library, part of the SunCalc.net project, for calculating sun position, sunlight phases (times for sunrise, sunset, dusk, etc.), moon position and lunar phase for the given location and time
schrute The complete scripts from the American version of the Office television show in tibble format
statebins The cartogram heatmaps generated by the included methods are an alternative to choropleth maps for the United States and are based on work by the Washington Post graphics department in their report on “The states most threatened by trade”
ttbbeer An R data package of beer statistics from U.S. Department of the Treasury, Alcohol and Tobacco Tax and Trade Bureau (TTB)
ukbabynames Full listing of UK baby names occurring more than three times per year between 1996 and 2015, and rankings of baby name popularity by decade from 1904 to 1994

Packages on GitHub only

These packages can be installed with:

library(devtools)
install_github("USERNAME/PACKAGENAME")

USERNAME refers to the user name of the developer of the package. For example, for the first package listed below, USERNAME is hadley and PACKAGENAME is emo.

Package Description
bingo Generate Bingo cards
BRRR BRRR extends the beepr package to include a number of rap adlibs
CatterPlots Plots with Cats
cooking Chopping, peeling, frying, and cooking various ingredients, and combining them to a delicious ragout. Also includes buying them from a local supermarket
dadjoke The goal of dadjoke is to make you laugh in spite of yourself
emo The goal of emo(ji) is to make it very easy to insert emoji into RMarkdown documents
emoGG Use Emoji in ggplot2
emokid For those times when you’re having trouble expressing how you feel about your broken code
flametree The goal of flametree is to make pretty pictures
ggbarf Make isotype bars using the vomit emoji
ggCyberPunk Create Cyberpunk area and line plots
ggiraph Create interactive ggplot2 graphics using htmlwidgets
ggkeyboard Plot a Keyboard Using ggplot2
jasmines Make generative art
kandinsky Turn any dataset into a Kandinsky painting
lego This R data package contains information about every Lego set manufactured from 1970 to 2015, a total of 6172 sets
linkinpark Data package that contains a few different datasets about the band
prenoms First names given to babies in metropolitan France between 1900 and 2015
raybonsai Generate 3D procedural trees in R, rendered with rayrender! Procedural generation code based on the flametree package by Danielle Navarro.

Part 3 - Peer review

For the last part of this assignment we’re asking you to review two projects. You will get access to the two project repos you will review after the workshop on Friday, 20 November. To locate these repos go to the course organisation on GitHub and look for project repos that are not your own, with the name project-SOME-OTHER-TEAM-NAME.

You will have limited access to these repos. You can open issues but you can’t make changes to them. To complete your review, go to the Issues tab and open a New Issue. Then, select the issue template titled Peer review, and answer the following questions for the project.

  1. Add links to the two issues you opened as part of your peer review. You don’t need to copy and paste the contents of the issues, just the links.