Due: 30 November by 11:00 pm
Weight: This assignment is worth 4% of your final grade.
Purpose, Skills, & Knowledge: The purposes of this assignment are:
- To practice exploring and data frames in R using the dplyr library
- To practice generating plots using the ggplot2 library
Assessment: Each question indicates the % of the assignment grade, summing to 100%. The credit for each question will be assigned as follows:
- 0% for not attempting a response.
- 50% for attempting the question but with major errors.
- 75% for attempting the question but with minor errors.
- 100% for correctly answering the question.
Rules: This entire assignment is SOLO. You may not work with other classmates, though you may consult instructors for help.
Download and use this template for your assignment. Inside the “hw11” folder, open and edit the R script called “hw11.R” and fill out your name, GW Net ID, and the names of anyone you worked with on this assignment.
For this assignment, you will need to find a dataset of your choosing and create three summary visualizations. To keep things manageable, choose one of the following datasets from the following libraries. Note that to load any of these data frames, all you need to do is install and load the library.
dplyr:
storms
starwars
ggplot2:
diamonds
economics
midwest
mpg
msleep
txhousing
dslabs:
gapminder
movielens
murders
stars
Once you’ve chosen a data set, open your hw11.R
file and begin exploring the data (be sure to load the library that contains the dataset at the top of your file). Write some code in code chunks to preview and summarize the data frame using some of the methods we’ve used in class. You should be able to quickly get an understanding of what variables are included and their nature. Consider the following questions in your exploration (you don’t have to write out answers to these questions - just write code to help you answer them by previewing the data in different ways):
Do not brush this step off - the more thoroughly you inspect your dataset, the easier (and better) you data exploration will be. This will be absolutely critical for making your plots. Make sure you take the time to develop an understanding of the variables in your dataset as it is nearly impossible to imagine what different plots might be worth creating otherwise.
Now that you have a basic understanding of the dataset, make some plots to explore the variables in the data and their potential relationships. You may use base R plotting functions or the ggplot2 library to make your figures, but you must make at least two different types of figures, including:
You can choose to plot whichever variables you wish, but you must be able to interpret the results of your plot.
Below the plot code for each of your plots, write a description and interpretation of your plot in a comment. Make sure you address at least the following questions:
At the bottom of your hw11.R
file, write code to save each of your three plots in the plots
folder. Save them as .png files.
Create a zip file of all files in your R project folder for this assignment and submit the zip file on Blackboard by the due deadline.