This homework was adapted from an assignment originally developed by Dr. Mine Çentinkaya-Rundel1 Click here for the original assignment.
In this homework assignment you will…
R
packageGo to the sta199-fa21-003 organization on GitHub. Click on the repo with the prefix hw-05. It contains the starter documents you need to complete the assignment.
Clone the repo and start a new project in RStudio. See the Lab 01 instructions for details on cloning a repo and starting a new R project.
For this exercise we will use the tidyverse
and palmerpenguins
R packages. You can add any other packages as needed.
We will use the penguins
data set in the palmerpenguins R package for this exercise. We will plot the flipper length versus the bill length.
ggplot(penguins, aes(x = flipper_length_mm, y = bill_length_mm,
color = species)) +
geom_point()
Pick a package. You can choose one from the list below, or venture into the great unknown and find another online. If you have trouble getting a package to work, you can ask for help in office hours or on Ed Discussion.
Install the package. Be sure to do this in the console, not in your R Markdown document. This is because you only need to install a package on time, and you do not want to re-install every time you knit the document.
Depending on where the package comes from, how you install the package differs:
If the package is on CRAN (Comprehensive R Archive Network), you can install it with install.packages
.
If the package is only on Github (most likely because it is still under development), you need to use the install_github
function in the devtools package, click here for more details.
Load the package. Regardless of how you installed the package you can load it with the library
function.
Do something with the package. Typically, simpler is better. The goal is for you to read and understand the package documentation to carry out a simple task.
Finally, write a short 3-4 sentence statement (at the beginning of your solution to this exercise) and include:
1️⃣ The name of the package you use and whether it is from CRAN or GitHub
2️⃣ A short description of what the package does (in your own words)
3️⃣ A short description of what you do with the package.
Sample list of packages on CRAN:
package name | description |
---|---|
ape | Manipulate, plot and interact with phylogenetic trees and models. Comes with sample data |
astrodatR | Astronomy datasets |
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) |
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 |
wesanderson | Color palettes from Wes Anderson films |
scatterplot3d | Create 3D plots |
Knit to PDF to create a PDF document. Stage and commit all remaining changes, and push your work to GitHub. Make sure all files are updated on your GitHub repo.
Only upload your PDF document to Gradescope. Before you submit the uploaded document, mark where each answer is to the exercises. If any answer spans multiple pages, then mark all pages. Associate the “Workflow & formatting” section with the first page.
Component | Points |
---|---|
Ex 1 | 19 |
Ex 2 | 25 |
Workflow & formatting | 6 |
Workflow and formatting includes having at least three meaningful commits, a neatly formatted PDF document with readable headers, updating the name and date, using the tidyverse syntax, and naming all code chunks.