Rstudio problem

Please help me with my homework problem by using dplyr function and mutate() knowladge. Here are the questrions

1.For how many schools do we have data? How many of these schools recorded their Measles, Mumps, and Rubella (MMR) vaccination rate? Use the variable mmr to answer this question. Only consider schools with a rate > 0 for the remainder of the homework.

Don't use plagiarized sources. Get Your Custom Essay on
Rstudio problem
Just from $13/Page
Order Essay

2.Using mutate(), reorder the levels of the variable state according to the median MMR vaccination rate. Then “pipe” your results into ggplot and create box plots of MMR vaccination rates for each state. Map the variable state to color, include the parameter show.legend = FALSE within geom_boxplot(), and flip the coordinates. Interpret.

3.According to the CDC, 95% of a population needs to be vaccinated to stop the spread of measles and preserve herd immunity. Using mutate() and case_when(), introduce a new variable into the data set mmr_threshold where the value is “above” when mmr is greater than 95 and “below” otherwise. Is there a relationship between the type of school and the proportion of schools that did not reach that threshold? For each type of school, calculate the mean MMR vaccination rate. On how many responses are the averages based? Show these numbers together with the averages. Additionally, calculate the percentage of schools that did not reach that threshold. Arrange your results from greatest percentage to lowest. Comment on your results.

4

  1. Use dplyr functions to:
  • only include observations with enrollment greater than 0 and exclude the school “West Valley School Prek-6” (there is an issue with that observation)
  • filter for rows that have a unique combination of the variables year, city, state, name, type, enroll, and mmr (there are duplicates in the data)
  • Inside mutate() use weighted.mean() to calculate the mean MMR vaccination rates weighted by the enrollment. Name this new variable state_avg.
  • For each city and state combination, calculate the mean MMR vaccination rate weighted by enrollment, the total number of students enrolled, and the mean of the state average calculated in the previous step.
  • only consider rows where the total enrollment is more than 250 and less than 100,000.

5.Now use the previous data set to draw a scatter plot with the mean MMR rate for each city on the y-axis and the student enrollment on the x-axis and color by the state mean MMR rate. Use the code below as your starting point and add in the necessary aesthetic mappings within ggplot(aes( )). Describe and summarise the chart.

Still struggling to complete your homework?
Get instant homework help from our expert academic writers!