Harvard Business School Rstudio Programming Questions 1.Data clean up:
Remove duplicates by keeping the distinct combinations of the variables state, name, county, overall, mmr, lat, lng, and enroll.
Filter out schools outside the continent (use lng < 0).
Use filtering to keep observations where mmr >= 0 or overall >= 0.
Using the function ifelse(), create a new variable rate where the value is equal to the value of mmr when mmr >= 0 is true and equal to overall when mmr >= 0 is false.
Save this data as measles_ne
2.Load the county map data using the function map_data() and save as us_counties
3.Additional data cleaning and data joining:
Begin with the measle_one data created in question 3.
Use the function str_to_lower() from the stringr package, to create a variable subregion that is the lowercase version of county.
Use the function str_to_lower() from the stringr package, to create a variable region that is the lowercase version of state.
For each region – subregion pair, use summarise() to calculate the mean of the variable rate.
Create a new variable threshold that is TRUE when rate > 0 and FALSE otherwise.
Use full_join() to join in the us_counties data by region and subregion.
Save this data as measles_two
4.Draw a map of the us counties and map the variable threshold to fill. Set the outline of the counties to the color #f4f4f8 and a size of 0.1. Apply the palette Dark2 from RColorBrewer, name the scale Rate > 95%, and set an na.value of grey80. Apply the theme theme_minimal().
5.Use geom_polygon()to draw a map of the counties (dont use the measles_one data yet). Apply the following parameters (outside of aes()): fill = “#f5f5f2”, color = “black”, and size = 0.1. Save this plot as plot1 and print.
I have attach all the question below in R format.
Consider the following information, and answer the question below. China and England are international trade…
The CPA is involved in many aspects of accounting and business. Let's discuss some other…
For your initial post, share your earliest memory of a laser. Compare and contrast your…
2. The Ajax Co. just decided to save $1,500 a month for the next five…
How to make an insertion sort to sort an array of c strings using the…
Assume the following Keynesian income-expenditure two-sector model: AD = Cp + Ip Cp = Co…