Due before class on April 23rd.
hw04
repositoryGo here to fork the repo for homework 04.
iris
.
for
loop to do this task.map
functions to do this task.Calculate the square of each element in vector x
:
x <- 1:30
x
## [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## [24] 24 25 26 27 28 29 30
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.
/Users/soltoffbc/Projects/Computing for Social Sciences/teach/homework/hw04
Once you have written this function, demonstrate that it works by importing the data files and combining them into a single data frame using an iterative operation.
Once you have the data imported, 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 (and is in fact mandatory).
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.