See files
Markdown To PDF title: "ISTA 320 Midterm Exam" author: "ENTER YOUR NAME HERE" date: "Fall 2021" output: html_documentoutput: html_document ```{r setup, include=FALSE} library(knitr) library(tidyverse) opts_chunk$set(echo = TRUE) # Part 1 -- COVID-19 Vaccine Distribution Allocation by Jurisdiction (50 points total) For this part of the midterm exam, you will be working with data from [Data.CDV.gov](https://data.cdc.gov/browse?category=Vaccinations) on COVID-19 Vaccine Distribution Allocation by Jurisdiction for Pfizer, Moderna, and Jannsen vaccines. ## Read Data In (8 points) There are three `COVID-19` csv files in the data folder in this project. - Read all three files (4 points) - Create a new `vaccine` column for each of the two dataframes (with the value "Pfizer" for the Pfizer dataframe, the value "Moderna" for the Moderna dataframe, and "Janssen" for the Janssen dataframe) (2 points) - Combine all three dataframes into one dataframe object (2 points) ```{r} # ENTER YOUR CODE HERE Data Wrangling (10 points)Data Wrangling (10 points) Pivot the 1st Dose Allocations and 2nd Dose Allocations columns in your all-vaccines dataframe to create a new dataframe that contains 5 variables: (10 points) 1) Jurisdiction 1) Week of Allocations 1) vaccine type (Pfizer and Moderna) 1) dose type (first and second dose) 1) and allocation count. HINT: use pivot_longer() ```{r} ENTER YOUR CODE HEREENTER YOUR CODE HERE ## Data Analysis (32 points) > Question: What is the total number of vaccine doses allocated by vaccine type (Pfizer, Moderna, and Janssen) and by dose (1st vs 2nd dose)? I will consider this question complete if you follow all of the steps: 1) summarize the total (use sum) number of allocations by vaccine and dose (5 points) 1) draw a plot mapping dose type (1st vs 2nd) to x and total number of allocations to y and vaccine manufacturer to color/fill (5 points) -- keep in mind that the Janssen vaccine only has one dose, so you might get warnings about rows being removed when plotting, which is fine) The type of plot (line or bar plot) is up to you. ```{r} # ENTER YOUR CODE HERE QUESTIONS TO ANSWER ABOUT PLOT (you have to enter your question answers in the prose): 1) Which manufacturer has allocated more vaccine shots in the US? (2.5 points) 1) Which dose (1st or 2nd) has had more allocations in the US? (2.5 points) Question: What is the total number of vaccine doses allocated by vaccine type (Pfizer, Moderna, and Janssen) and by dose (1st vs 2nd dose) in Arizona only across time? I will consider this question complete if you follow all of the steps: 1) filter data to keep Jurisdiction that is equal to "Arizona" only (5 points) 1) summarize the total (use sum) number of allocations by vaccine and dose (5) 1) draw a plot mapping dose type (1st vs 2nd) to x and total number of allocations to y and vaccine manufacturer to color/fill (5 points) The type of plot (line or bar plot) is up to you. ```{r} ENTER YOUR CODE HEREENTER YOUR CODE HERE QUESTIONS TO ANSWER ABOUT PLOT (you have to enter your question answers in the prose): 1) How different in the Arizona plot compared to the overall plot (i.e., the first plot you created)? (2 points) # Part 2 -- Unemployment Rates in the US 2019-2021 (50 points total) In this second part of the midterm exam, you will be working with unemployment in the US data from [BLS Beta Labs](https://beta.bls.gov/dataQuery/find?q=unemployment). ## Read Data In (10 points) There are four csv files inside a folder called `unemployment` inside the `data` folder in this project. 1) Read all four files in, making sure you keep the filename as a variable for race-ethnic-cultural (Asian, Black, Hispanic or Latino, and White). (10 points) ```{r} # ENTER YOUR CODE HERE Data Analysis (40 points)Data Analysis (40 points) Question: What is the unemployment rate across race/ethnicity in the US for the years of 2019-2021? I will consider this question complete if you follow all of the steps: 1) draw a line plot mapping x to month (i.e., Period), y to unemployment rate (i.e., Value), and color to race/ethnicity. Facet your plot by Year. (25 points) Option steps before plotting: 1) mutate Period so it's a number (it will make the plot easier to read) 1) move the legend to the bottom of the plot (the default position of the legend is to the right of the plot) ```{r} ENTER YOUR CODE HEREENTER YOUR CODE HERE ``` QUESTIONS TO ANSWER ABOUT PLOT (you have to enter your question answers in the prose): 1) What race/ethnicity has the highest unemployment rate in the US in the year of 2019? (7.5 points) 1) Has the pattern of unemployment changed in 2020? How so? Can you explain the changes? (7.5 points) output: html_document Data Wrangling (10 points) ENTER YOUR CODE HERE ENTER YOUR CODE HERE Data Analysis (40 points) ENTER YOUR CODE HERE __MACOSX/._data data/COVID-19_Vaccine_Distribution_Allocations_by_Jurisdiction_-_Moderna.csv Jurisdiction,Week of Allocations,1st Dose Allocations,2nd Dose Allocations Connecticut,06/21/2021,41220,41220 Maine,06/21/2021,15800,15800 Massachusetts,06/21/2021,79500,79500 New Hampshire,06/21/2021,15800,15800 Rhode Island,06/21/2021,12480,12480 Vermont,06/21/2021,7480,7480 New Jersey,06/21/2021,100620,100620 New York,06/21/2021,128240,128240 New York City,06/21/2021,97400,97400 Puerto Rico,06/21/2021,39400,39400 U.S. Virgin Islands,06/21/2021,1360,1360 Delaware,06/21/2021,10940,10940 District of Columbia,06/21/2021,8320,8320 Maryland,06/21/2021,68000,68000 Pennsylvania,06/21/2021,129600,129600 Philadelphia,06/21/2021,18040,18040 Virginia,06/21/2021,95480,95480 West Virginia,06/21/2021,21360,21360 Alabama,06/21/2021,54960,54960 Florida,06/21/2021,239560,239560 Georgia,06/21/2021,113660,113660 Kentucky,06/21/2021,49960,49960 Mississippi,06/21/2021,33140,33140 North Carolina,06/21/2021,114640,114640 South Carolina,06/21/2021,56320,56320 Tennessee,06/21/2021,75060,75060 Chicago,06/21/2021,30520,30520 Illinois,06/21/2021,113660,113660 Indiana,06/21/2021,73840,73840 Michigan,06/21/2021,113100,113100 Minnesota,06/21/2021,62020,62020 Ohio,06/21/2021,131560,131560 Wisconsin,06/21/2021,65900,65900 Arkansas,06/21/2021,33420,33420 Louisiana,06/21/2021,51880,51880 New Mexico,06/21/2021,23700,23700 Oklahoma,06/21/2021,43280,43280 Texas,06/21/2021,300040,300040 Iowa,06/21/2021,35100,35100 Kansas,06/21/2021,32060,32060 Missouri,06/21/2021,68560,68560 Nebraska,06/21/2021,21220,21220 Colorado,06/21/2021,62300,62300 Montana,06/21/2021,12060,12060 North Dakota,06/21/2021,8600,8600 South Dakota,06/21/2021,9680,9680 Utah,06/21/2021,31220,31220 Wyoming,06/21/2021,6640,6640 Arizona,06/21/2021,77860,77860 California,06/21/2021,438000,438000 Hawaii,06/21/2021,16360,16360 Nevada,06/21/2021,32860,32860 American Samoa,06/21/2021,0,0 Guam,06/21/2021,0,0 Marshall Islands,06/21/2021,0,0 Micronesia,06/21/2021,0,0 Mariana Islands,06/21/2021,0,0 Palau,06/21/2021,0,0 Alaska,06/21/2021,12060,12060 Idaho,06/21/2021,18320,18320 Oregon,06/21/2021,47160,47160 Washington,06/21/2021,83520,83520 Federal Entities,06/21/2021,164800,164800 Connecticut,06/14/2021,41220,41220 Maine,06/14/2021,15800,15800 Massachusetts,06/14/2021,79500,79500 New Hampshire,06/14/2021,15800,15800 Rhode Island,06/14/2021,12480,12480 Vermont,06/14/2021,7480,7480 New Jersey,06/14/2021,100620,100620 New York,06/14/2021,128240,128240 New York City,06/14/2021,97400,97400 Puerto Rico,06/14/2021,39400,39400 U.S. Virgin Islands,06/14/2021,1360,1360 Delaware,06/14/2021,10940,10940 District of Columbia,06/14/2021,8320,8320 Maryland,06/14/2021,68000,68000 Pennsylvania,06/14/2021,129600,129600 Philadelphia,06/14/2021,18040,18040 Virginia,06/14/2021,95480,95480 West Virginia,06/14/2021,21360,21360 Alabama,06/14/2021,54960,54960 Florida,06/14/2021,239560,239560 Georgia,06/14/2021,113660,113660 Kentucky,06/14/2021,49960,49960 Mississippi,06/14/2021,33140,33140 North Carolina,06/14/2021,114640,114640 South Carolina,06/14/2021,56320,56320 Tennessee,06/14/2021,75060,75060 Chicago,06/14/2021,30520,30520 Illinois,06/14/2021,113660,113660 Indiana,06/14/2021,73840,73840 Michigan,06/14/2021,113100,113100 Minnesota,06/14/2021,62020,62020 Ohio,06/14/2021,131560,131560 Wisconsin,06/14/2021,65900,65900 Arkansas,06/14/2021,33420,33420 Louisiana,06/14/2021,51880,51880 New Mexico,06/14/2021,23700,23700 Oklahoma,06/14/2021,43280,43280 Texas,06/14/2021,300040,300040 Iowa,06/14/2021,35100,35100 Kansas,06/14/2021,32060,32060 Missouri,06/14/2021,68560,68560 Nebraska,06/14/2021,21220,21220 Colorado,06/14/2021,62300,62300 Montana,06/14/2021,12060,12060 North Dakota,06/14/2021,8600,8600 South Dakota,06/14/2021,9680,9680 Utah,06/14/2021,31220,31220 Wyoming,06/14/2021,6640,6640 Arizona,06/14/2021,77860,77860 California,06/14/2021,438000,438000 Hawaii,06/14/2021,16360,16360 Nevada,06/14/2021,32860,32860 American Samoa,06/14/2021,0,0 Guam,06/14/2021,0,0 Marshall Islands,06/14/2021,0,0 Micronesia,06/14/2021,0,0 Mariana Islands,06/14/2021,0,0 Palau,06/14/2021,0,0 Alaska,06/14/2021,12060,12060 Idaho,06/14/2021,18320,18320 Oregon,06/14/2021,47160,47160 Washington,06/14/2021,83520,83520 Federal Entities,06/14/2021,164800,164800 Connecticut,06/07/2021,41220,41220 Maine,06/07/2021,15800,15800 Massachusetts,06/07/2021,79500,79500 New Hampshire,06/07/2021,15800,15800 Rhode Island,06/07/2021,12480,12480 Vermont,06/07/2021,7480,7480 New Jersey,06/07/2021,100620,100620 New York,06/07/2021,128240,128240 New York City,06/07/2021,97400,97400 Puerto Rico,06/07/2021,39400,39400 U.S. Virgin Islands,06/07/2021,1360,1360 Delaware,06/07/2021,10940,10940 District of Columbia,06/07/2021,8320,8320 Maryland,06/07/2021,68000,68000 Pennsylvania,06/07/2021,129600,129600 Philadelphia,06/07/2021,18040,18040 Virginia,06/07/2021,95480,95480 West Virginia,06/07/2021,21360,21360 Alabama,06/07/2021,54960,54960 Florida,06/07/2021,239560,239560 Georgia,06/07/2021,113660,113660 Kentucky,06/07/2021,49960,49960 Mississippi,06/07/2021,33140,33140 North Carolina,06/07/2021,114640,114640 South Carolina,06/07/2021,56320,56320 Tennessee,06/07/2021,75060,75060 Chicago,06/07/2021,30520,30520 Illinois,06/07/2021,113660,113660 Indiana,06/07/2021,73840,73840 Michigan,06/07/2021,113100,113100 Minnesota,06/07/2021,62020,62020 Ohio,06/07/2021,131560,131560 Wisconsin,06/07/2021,65900,65900 Arkansas,06/07/2021,33420,33420 Louisiana,06/07/2021,51880,51880 New Mexico,06/07/2021,23700,23700 Oklahoma,06/07/2021,43280,43280 Texas,06/07/2021,300040,300040 Iowa,06/07/2021,35100,35100 Kansas,06/07/2021,32060,32060 Missouri,06/07/2021,68560,68560 Nebraska,06/07/2021,21220,21220 Colorado,06/07/2021,62300,62300 Montana,06/07/2021,12060,12060 North Dakota,06/07/2021,8600,8600 South Dakota,06/07/2021,9680,9680 Utah,06/07/2021,31220,31220 Wyoming,06/07/2021,6640,6640 Arizona,06/07/2021,77860,77860 California,06/07/2021,438000,438000 Hawaii,06/07/2021,16360,16360 Nevada,06/07/2021,32860,32860 American Samoa,06/07/2021,0,0 Guam,06/07/2021,0,0 Marshall Islands,06/07/2021,0,0 Micronesia,06/07/2021,0,0 Mariana Islands,06/07/2021,0,0 Palau,06/07/2021,0,0 Alaska,06/07/2021,12060,12060 Idaho,06/07/2021,18320,18320 Oregon,06/07/2021,47160,47160 Washington,06/07/2021,83520,83520 Federal Entities,06/07/2021,161000,161000 Connecticut,05/31/2021,40320,40320 Maine,05/31/2021,15400,15400 Massachusetts,05/31/2021,77700,77700 New Hampshire,05/31/2021,15400,15400 Rhode Island,05/31/2021,12180,12180 Vermont,05/31/2021,7280,7280 New Jersey,05/31/2021,98420,98420 New York,05/31/2021,125440,125440 New York City,05/31/2021,95200,95200 Puerto Rico,05/31/2021,38500,38500 U.S. Virgin Islands,05/31/2021,1260,1260 Delaware,05/31/2021,10640,10640 District of Columbia,05/31/2021,8120,8120 Maryland,05/31/2021,66500,66500 Pennsylvania,05/31/2021,126700,126700 Philadelphia,05/31/2021,17640,17640 Virginia,05/31/2021,93380,93380 West Virginia,05/31/2021,20860,20860 Alabama,05/31/2021,53760,53760 Florida,05/31/2021,234360,234360 Georgia,05/31/2021,111160,111160 Kentucky,05/31/2021,48860,48860 Mississippi,05/31/2021,32340,32340 North Carolina,05/31/2021,112140,112140 South Carolina,05/31/2021,55020,55020 Tennessee,05/31/2021,73360,73360 Chicago,05/31/2021,29820,29820 Illinois,05/31/2021,111160,111160 Indiana,05/31/2021,72240,72240 Michigan,05/31/2021,110600,110600 Minnesota,05/31/2021,60620,60620 Ohio,05/31/2021,128660,128660 Wisconsin,05/31/2021,64400,64400 Arkansas,05/31/2021,32620,32620 Louisiana,05/31/2021,50680,50680 New Mexico,05/31/2021,23100,23100 Oklahoma,05/31/2021,42280,42280 Texas,05/31/2021,293440,293440 Iowa,05/31/2021,34300,34300 Kansas,05/31/2021,31360,31360 Missouri,05/31/2021,67060,67060 Nebraska,05/31/2021,20720,20720 Colorado,05/31/2021,60900,60900 Montana,05/31/2021,11760,11760 North Dakota,05/31/2021,8400,8400 South Dakota,05/31/2021,9380,9380 Utah,05/31/2021,30520,30520 Wyoming,05/31/2021,6440,6440 Arizona,05/31/2021,76160,76160 California,05/31/2021,428400,428400 Hawaii,05/31/2021,15960,15960 Nevada,05/31/2021,32060,32060 American Samoa,05/31/2021,0,0 Guam,05/31/2021,0,0 Marshall Islands,05/31/2021,0,0 Micronesia,05/31/2021,0,0 Mariana Islands,05/31/2021,0,0 Palau,05/31/2021,0,0 Alaska,05/31/2021,11760,11760 Idaho,05/31/2021,17920,17920 Oregon,05/31/2021,46060,46060 Washington,05/31/2021,81620,81620 Federal Entities,05/31/2021,164800,164800 Connecticut,05/24/2021,41220,41220 Maine,05/24/2021,15800,15800 Massachusetts,05/24/2021,79500,79500 New Hampshire,05/24/2021,15800,15800 Rhode Island