Academic Honesty

In a recent semester, we had a big problem with honesty on the computing assignments. My least favorite part of my job is sanctioning students who cheat. It’s a lot of work, uncomfortable, and unrewarding. That said, it is my job. Please make sure to complete the assignment honestly.

This document details the standards. Please read it carefully before you begin.

Do the following:

Start a new project in RStudio Cloud.

Install the package tidyverse.

Upload the .rds version of the health data set from the data page. This data set contains measures of approval for the ACA and measure of health at the state level from about 2013.

Start a new R script. Save the script as analysis.R.

In the script, do the following (include comments!):

  1. Load the tidyverse package.
  2. Load the data file health.rds.
  3. Use the glimpse functions to quickly (1) check the data are what you expect and (2) see the variable names. Compare to the codebook if you need more information.
  4. Create a scatterplot with the following features:
    1. the level of uninsurance (percent_uninsured) along the x-axis.
    2. the percent favorable to the ACA (percent_favorable_aca) along the y-axis.
    3. rather than use geom_point() use geom_label() where the states’ two-letter code (state_abbr) corresponds to the label aesthetic. Hint: You’ll need to add label = state_abbr to your aes().
    4. the regression line through the data.
    5. the life expectancy in the state (life_expectancy) corresponds to the color aesthetic.
    6. a nice title, subtitle, axis labels, etc.
  5. At the bottom of your script, in a single comment, explain the scatterplot.
    1. Explain the pattern you observe.
    2. Note whether there’s anything unexpected.
    3. Speculate about why we obtain that particular pattern.

Once you are satisfied with your code and observations, click the tiny notebook icon (to the left of the Run button). When prompted, select PDF (PDF tends to work better, in my experience) or MS Word. You may be prompted to download the document–do it! If not, then select the Files tab in the lower-right, check the box for the document you want to download (it should be analysis.docx or analysis.pdf), and click More > Export…, and follow the instructions Submit this docx or .pdf file to Canvas. Do not submit the .R script itself.

Examples:

The follow shows the basic format of the R code and shows what the output should look like after you compile it into a notebook.