Assignment 4 PS 3780 Data Literacy & Visualization, Summer 2022 Due Date: Thursday, June XXXXXXXXXXat 11:59 p.m. Please save your answer to these questions as one .pdf �le (use the �save as� function...

1 answer below »
in the file


Assignment 4 PS 3780 Data Literacy & Visualization, Summer 2022 Due Date: Thursday, June 16 2022 at 11:59 p.m. Please save your answer to these questions as one .pdf �le (use the �save as� function in most word processors). Be sure to include your name, your teammate's name if there is anyone, and the assignment number. Submit the �le to Carmen by the due date. More R and Dataset Management Health and the Economy How much does one's personal situation a�ect their perspective on how their local econ- omy is doing? There is plenty of actual evidence and common sense to suggest that often, but not always, individuals accurately explain their local economy based solely on their evaluation of personal and family situation. Some scholars argue that this e�ect is purely arti�cial and surveys are not good measures as respondents tend to use a `general feeling' to mark everything as good or bad without di�erentiation. Let's prepare a dataset to ad- dress a potential case of this relationship. Follow the steps below, ultimately submitting 3 csv �les along with answers and code for each item. 1. Download two speci�c state-level datasets from Gallup Analytics: Economic Con�- dence Index and Health Rating (https://analyticscampus-gallup-com.proxy. lib.ohio-state.edu/). 2. (.5 pt) Clean these two datasets (in Excel or a similar program) and save them as csv �les using the steps below: ˆ Delete the �rst several rows so that the column names are the �rst row in the spreadsheet. ˆ Delete the blank �rst column. ˆ Delete 10 rows of blank data after the numbers stop (it thinks there's data there) ˆ Save the datasets. 3. Load the datasets into RStudio using one of the methods below to ensure that variables which should be numeric are recognized as such: 1 https://analyticscampus-gallup-com.proxy.lib.ohio-state.edu/ https://analyticscampus-gallup-com.proxy.lib.ohio-state.edu/ ˆ Within original csv �le, highlight the column and use `Format Cells...' to set Category as Number. ˆ Within R, after using read.csv to load in the dataset, use as.numeric(gsub(...)) to remove troublesome characters and reformat the columns. See lecture for review. ˆ Within R, load using readr from the Import Dataset button above the global environment and con�rm number columns have the type `double'. 4. Check that there are no extra blank rows of data using anyNA(econ$Time) and anyNA(health$Time) for your assigned dataset names (in place of `econ' and `health'). The answer to both should be `FALSE'. 5. Load the `reshape2' and `plyr' libraries. 6. (2 pt) Using merge( ), combine the two datasets so that each row contains an entry for exactly one state and one year (456 obs). ˆ What is the correlation between Excellent health and economic con�dence across the entire dataset? ˆ Export this dataset as combined.csv using write.csv( ) and submit with the assignment. 7. (3 pt) Use ddply( ) to analyze the relationship between health status and economic con�dence within each state. ˆ Set the constant variable to Geography ˆ Set the function as summarize and use cor( ) to calculate two di�erent correlations: � economic con�dence and excellent health � economic con�dence and very good health ˆ Use summary( ) to report the minimum, mean, median, and maximum cor- relation for each. ˆ Write two sentences about the discovered relationship between the variables. 8. (2 pt) Use dcast( ) to change the econ dataset from long to wide form, such that each row is a state and each column is the economic con�dence for a year within the range 2008 - 2016 (51 obs). ˆ What was the Median economic con�dence in 2011? ˆ Export this dataset as econ_cast.csv using write.csv( ) and submit with the assignment. 9. (2 pt) Use melt( ) to change the health dataset from wide to long form, such that each row is the percentage of respondents from a particular state, in one year, for a speci�c health status (2280 obs). ˆ Which state-year-status had the largest response? Which had the smallest? ˆ Export this dataset as health_melt.csv using write.csv( ) and submit with the assignment. 2
Answered 3 days AfterJun 15, 2022

Answer To: Assignment 4 PS 3780 Data Literacy & Visualization, Summer 2022 Due Date: Thursday, June...

Subhanbasha answered on Jun 18 2022
96 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here