Photo by Kari Shea on Unsplash
It’s almost time to wrap up the course! In this three part assignment you get to practice what we learned this week, try something new, and get creative!
Go to the course GitHub organization and locate your homework repo, clone it in RStudio and open the R Markdown document. Knit the document to make sure it compiles without errors.
Before we introduce the data, let’s warm up with some simple exercises. Update the YAML of your R Markdown file with your information, knit, commit, and push your changes. Make sure to commit with a meaningful commit message. Then, go to your repo on GitHub and confirm that your changes are visible in your Rmd and md files. If anything is missing, commit and push again.
We’ll use the tidyverse package for the first part of this assignment. For the second part you get to choose which package to use.
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.
🧶 ✅ ⬆️ Knit, commit, and push your changes to GitHub with an appropriate commit message. Make sure to commit and push all changed files so that your Git pane is cleared up afterwards.
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 the 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
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.
Note: For the output generated by some of these packages to show up properly, you might need to change the output of your R Markdown document from
html_document in the YAML of your R Markdown document.
These packages can be installed with:
|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|
|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|
|praise||Build friendly R packages that praise their users if they have done something good, or they just need it to feel better|
|suncalc||R interface to
|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|
These packages can be installed with:
USERNAME refers to the user name of the developer of the package. For example, for the first package listed below,
|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.|
🧶 ✅ ⬆️ Knit, commit, and push your changes to GitHub with an appropriate commit message. Make sure to commit and push all changed files so that your Git pane is cleared up afterwards and review the md document on GitHub to make sure you’re happy with the final state of your work.