Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use R There are two data files world_pop.csv and world_pop_metadata.txt which include the information about the world population from 1960~2020 (downloaded from The world bank).

Use R

There are two data files world_pop.csv and world_pop_metadata.txt which include the information about the world population from 1960~2020 (downloaded from The world bank). The world_pop.csv file includes the population estimates for different countries and the world_pop_metadata.txt file includes the information about income and region of each country.

There are some missing values in both data sets and unfortunately the missing data structures are different in the two data sets. In this question, our goal is to transform these two data sets so that they contain no missing values while sharing the same countries.

A. Read world_pop.csv as a data frame and assign it to pop. There may be some redundant lines at the top of the file. Drop these lines. Print the first few lines of the data.

B. Read world_pop_metadata.txt as a data frame and assign it to pop.meta. Print the first few rows

C. Check if there are any missing values in pop and pop.meta.

D. Remove the missing values from pop and pop.meta and create new pop1 and pop.meta1 objects.

E. How many cases (countries) remain in each data, pop1, pop.meta1, respectively?

F. The two data sets currently may have different countries. How many observations in pop1 are not in pop.meta1? Similarly, how many observations in pop.meta1 are not in pop1?

Hint: both data frames have the same Country.Code variable.

G. Subset the data sets so that they contain the same countries and create new pop2 and pop.meta2 objects. Then, check the number of rows and columns.

H. Check if the countries in the two data sets (pop2, pop.meta2) are now the same using all() function.

I. Find the indexes (entries) that contain "Brazil", "India", "Nigeria", "United States", "Spain" in pop2.

G. Export the cleaned data sets to two csv files.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions