This content is from the fall 2016 version of this course. Please go here for the most recent version.
Due before class Wednesday October 19th.
hw03
repositoryGo here to fork the repo for homework 03.
mtcars
.
for
loop to do this task.map
functions to do this task.iris
.
for
loop to do this task.map
functions to do this task.stop()
. Likewise, if the user provides the lengths of all three sides, the function should throw an error.The World Bank publishes extensive socioeconomic data on countries around the world. In the data_world_bank
folder, I have downloaded the World Bank’s complete economic indicators for each country that is currently a member of the United Nations Security Council.
In order to analyze the data, you first need to import it. Each country’s data is stored in a separate .csv
file. You should write a function which uses one argument (the filepath to the data file). Given this path, the function should read and tidy the country data, and return the cleaned data frame as the output. Remember the rules for a tidy data frame:
Since the World Bank has hundreds of indicators, your function should pare this down to only the handful of variables you intend to analyze. Once you have written this function, demonstrate that it works by importing the data files and combining them into a single data frame using either a for
loop or a map
function.
Once you have the data imported, you should write a brief report exploring and analyzing at least two variables in the data. You should explore both variance and covariance, and present your results and analysis in a coherent and interpretable manner. The main point is that your report should not just be code and output from R - you also need to include your own written analysis. Submitting the report as an R Markdown document will make this much easier.
Your assignment should be submitted as two RMarkdown documents. Follow instructions on homework workflow. As part of the pull request, you’re encouraged to reflect on what was hard/easy, problems you solved, helpful tutorials you read, etc.
Check minus: Displays minimal effort. Doesn’t complete all components. Code is poorly written and not documented. World Bank analysis is slapped together, or just contains code and output. No history of commits to document work.
Check: Solid effort. Hits all the elements. No clear mistakes. Easy to follow (both the code and the output). Nothing spectacular, either bad or good.
Check plus: Functions are written succinctly and comprehensibly. Error checks are incorporated into functions as appropriate. Code is written parsimoniously and properly formatted. Frequent use of commits to track changes. Exploratory analysis demonstrates thought and consideration of the relationships. Graphs and tables are properly labeled. Descriptive text is incorporated into the World Bank analysis that explains what you are examining and how to interpret the results.
This work is licensed under the CC BY-NC 4.0 Creative Commons License.