Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a b C 6 . Obtain USA state boundary coordinates data for USA map using function map_data () and store the data in ndat .
a b C 6 . Obtain USA state boundary coordinates data for USA map using function map_data () and store the data in ndat . Display first few data from mdat and notice that there is a column called order that contains the true order of coordinatm . You will find USA crime data in the data frame called USArrests . Standardize the crime rates and create a new column called state so that all the state names are lower case. Store the new data in an object called arrest and report rst few rows of arrest . Merge the two data sets mdat and arrest by state name . Merging will change the order of coordinates data . So, order the data back to the original order and store the merged sordered data in odat . Report rst few data from odat . . All the columns of odat is not necessary for our analysis . So1 subset by selecting only columns long , lat, group , region , Murder , Assault , UrbanPop , Rape . Store the data in sdat and report rst few rows. . Melt the data frame sdat with id variables long, lat, group , region . Store the molten data in msdat and report rst few rows of data. The molten data frame nsdat is now ready to be plotted .Create a plot showing USA state map , ll with value and facet_urap with variable. Please don't add any legend and make sure that faceting labels are identied so that we can compare the facetted plots . . Now examine the plot you have generated in question (f) and answer the following questions based on what you see in the plot. i. For each of the crimes, name two states with the highest crime rate. ii. Do you think larger urban population is an indicative of larger murder rate? Why or why not? . In question (3b) we standardized the crime rates. Why do you think we did this? Explain what would happen if we would not do this. In question (3c) we ordered the data after merging. Why do you think we have to order? Explain what would happen if we would not order. _ Life expectancy data for four celmtries are obtained from the world bank database which you will nd on github. It contains life expectancy in years for different genders. Now answer the following questions. . Read the data from the above link and display first few rows of the data. . Generate a plot showing trend line of life expectancy over different year. Color them by sex and facet by country. Include your code and the plot. .Explain what interesting features you notice in the plot of question 5b. . We have a data set as below; myDat
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started