#1. Data Exploration: This should include summary statistics, means, medians, quartiles, or any other relevant information about the data set. Please include some conclusions in the R Markdown text.
library(readr)
require(RCurl)
## Loading required package: RCurl
## Loading required package: bitops
UNStatistics <-read.csv(text=getURL("https://raw.githubusercontent.com/samsri01/Repo-For-CSV-File-Storage/master/UN_Statistics.csv"),header=TRUE)
summary.data.frame(UNStatistics)
## X region group fertility
## Afghanistan : 1 Africa :53 africa: 53 Min. :1.134
## Albania : 1 Asia :50 oecd : 31 1st Qu.:1.754
## Algeria : 1 Europe :39 other :115 Median :2.262
## American Samoa: 1 Latin Amer:20 NA's : 14 Mean :2.761
## Angola : 1 Caribbean :17 3rd Qu.:3.545
## Anguilla : 1 (Other) :20 Max. :6.925
## (Other) :207 NA's :14 NA's :14
## ppgdp lifeExpF pctUrban infantMortality
## Min. : 114.8 Min. :48.11 Min. : 11.00 Min. : 1.916
## 1st Qu.: 1283.0 1st Qu.:65.66 1st Qu.: 39.00 1st Qu.: 7.019
## Median : 4684.5 Median :75.89 Median : 59.00 Median : 19.007
## Mean : 13012.0 Mean :72.29 Mean : 57.93 Mean : 29.440
## 3rd Qu.: 15520.5 3rd Qu.:79.58 3rd Qu.: 75.00 3rd Qu.: 44.477
## Max. :105095.4 Max. :87.12 Max. :100.00 Max. :124.535
## NA's :14 NA's :14 NA's :14 NA's :6
# Analyzing Data to draw some hypothesis/conclusions
# group is a vector with 3 levels "africa","oecd","other"
levels(UNStatistics$group)
## [1] "africa" "oecd" "other"
#Dividing the UNStatics data frame individually for different groups to analyze, it better.
#Dataframe with group as "africa"
africanCountriesData <- subset.data.frame(UNStatistics,group=="africa", select=c(X,region,group,fertility,ppgdp,lifeExpF,pctUrban,infantMortality))
summary.data.frame(africanCountriesData)
## X region group fertility
## Algeria : 1 Africa :53 africa:53 Min. :1.590
## Angola : 1 Asia : 0 oecd : 0 1st Qu.:3.174
## Benin : 1 Caribbean : 0 other : 0 Median :4.423
## Botswana : 1 Europe : 0 Mean :4.236
## Burkina Faso: 1 Latin Amer : 0 3rd Qu.:5.078
## Burundi : 1 North America: 0 Max. :6.925
## (Other) :47 (Other) : 0
## ppgdp lifeExpF pctUrban infantMortality
## Min. : 114.8 Min. :48.11 Min. :11.00 Min. : 12.11
## 1st Qu.: 509.0 1st Qu.:53.14 1st Qu.:28.00 1st Qu.: 46.94
## Median : 980.7 Median :58.59 Median :40.00 Median : 67.02
## Mean : 2508.8 Mean :59.77 Mean :42.62 Mean : 65.32
## 3rd Qu.: 2865.0 3rd Qu.:63.82 3rd Qu.:59.00 3rd Qu.: 85.88
## Max. :16852.4 Max. :78.00 Max. :86.00 Max. :123.94
## NA's :1
#Dataframe with group as "oecd" and "other"
nonAfricanCountriesData <- subset.data.frame(UNStatistics,group=="oecd" | group=="other", select=c(X,region,group,fertility,ppgdp,lifeExpF,pctUrban,infantMortality))
summary.data.frame(nonAfricanCountriesData)
## X region group fertility
## Afghanistan: 1 Asia :50 africa: 0 Min. :1.134
## Albania : 1 Europe :39 oecd : 31 1st Qu.:1.578
## Anguilla : 1 Latin Amer :20 other :115 Median :2.011
## Argentina : 1 Caribbean :17 Mean :2.226
## Armenia : 1 Oceania :17 3rd Qu.:2.498
## Aruba : 1 North America: 2 Max. :5.968
## (Other) :140 (Other) : 1
## ppgdp lifeExpF pctUrban infantMortality
## Min. : 499 Min. :49.49 Min. : 13.00 Min. : 1.916
## 1st Qu.: 3005 1st Qu.:73.70 1st Qu.: 49.25 1st Qu.: 5.405
## Median : 7568 Median :77.50 Median : 67.00 Median : 13.063
## Mean : 16825 Mean :76.84 Mean : 63.49 Mean : 17.985
## 3rd Qu.: 24279 3rd Qu.:81.26 3rd Qu.: 81.75 3rd Qu.: 23.515
## Max. :105095 Max. :87.12 Max. :100.00 Max. :124.535
## NA's :5
#Dataframe with group as "oecd"
oecdCountriesData <- subset.data.frame(UNStatistics,group=="oecd" , select=c(X,region,group,fertility,ppgdp,lifeExpF,pctUrban,infantMortality))
summary.data.frame(oecdCountriesData)
## X region group fertility
## Australia : 1 Europe :22 africa: 0 Min. :1.312
## Austria : 1 Asia : 3 oecd :31 1st Qu.:1.476
## Belgium : 1 Latin Amer : 2 other : 0 Median :1.794
## Canada : 1 North America: 2 Mean :1.765
## Chile : 1 Oceania : 2 3rd Qu.:1.948
## Czech Republic: 1 Africa : 0 Max. :2.909
## (Other) :25 (Other) : 0
## ppgdp lifeExpF pctUrban infantMortality
## Min. : 9101 Min. :76.61 Min. :49.00 Min. : 2.289
## 1st Qu.: 20138 1st Qu.:81.34 1st Qu.:68.00 1st Qu.: 3.346
## Median : 39546 Median :82.79 Median :78.00 Median : 3.914
## Mean : 37761 Mean :82.45 Mean :75.81 Mean : 4.890
## 3rd Qu.: 46453 3rd Qu.:83.52 3rd Qu.:85.00 3rd Qu.: 4.841
## Max. :105095 Max. :87.12 Max. :97.00 Max. :19.901
##
#Dataframe with group as "other"
otherCountriesData <- subset.data.frame(UNStatistics,group== "other" , select=c(X,region,group,fertility,ppgdp,lifeExpF,pctUrban,infantMortality))
summary.data.frame(otherCountriesData)
## X region group fertility
## Afghanistan: 1 Asia :47 africa: 0 Min. :1.134
## Albania : 1 Latin Amer :18 oecd : 0 1st Qu.:1.650
## Anguilla : 1 Caribbean :17 other :115 Median :2.171
## Argentina : 1 Europe :17 Mean :2.350
## Armenia : 1 Oceania :15 3rd Qu.:2.611
## Aruba : 1 NorthAtlantic: 1 Max. :5.968
## (Other) :109 (Other) : 0
## ppgdp lifeExpF pctUrban infantMortality
## Min. : 499 Min. :49.49 Min. : 13.00 Min. : 1.916
## 1st Qu.: 2527 1st Qu.:72.47 1st Qu.: 44.50 1st Qu.: 10.558
## Median : 5195 Median :76.37 Median : 60.00 Median : 18.268
## Mean :11181 Mean :75.33 Mean : 60.17 Mean : 21.676
## 3rd Qu.:12857 3rd Qu.:78.34 3rd Qu.: 76.00 3rd Qu.: 26.098
## Max. :92625 Max. :86.35 Max. :100.00 Max. :124.535
## NA's :5
#Drawing inferential statistics using t.test function for the above data frames.
#Comparing african data frame with OECD and other country details
#Below t.test() results gives us a positive number for 't', meaning, the urban population in all the non african countries is greater than african nations.
t.test(nonAfricanCountriesData$pctUrban,africanCountriesData$pctUrban)
##
## Welch Two Sample t-test
##
## data: nonAfricanCountriesData$pctUrban and africanCountriesData$pctUrban
## t = 6.7903, df = 118.74, p-value = 4.7e-10
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 14.77952 26.94780
## sample estimates:
## mean of x mean of y
## 63.48630 42.62264
#Below t.test() results gives us a positive number for 't', meaning, the GDP for all the non african countries is greater than african nations.Implies the quality of living is better in non african countries when compared to african nations.
t.test(nonAfricanCountriesData$ppgdp,africanCountriesData$ppgdp)
##
## Welch Two Sample t-test
##
## data: nonAfricanCountriesData$ppgdp and africanCountriesData$ppgdp
## t = 8.2533, df = 168.3, p-value = 4.288e-14
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 10891.68 17740.33
## sample estimates:
## mean of x mean of y
## 16824.758 2508.751
#Below t.test() results gives us a positive number for 't', meaning, the fertiltiy or children/woman is higher in african countries compared to non african nations.
t.test(africanCountriesData$fertility,nonAfricanCountriesData$fertility)
##
## Welch Two Sample t-test
##
## data: africanCountriesData$fertility and nonAfricanCountriesData$fertility
## t = 10.414, df = 69.529, p-value = 7.79e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 1.625143 2.395165
## sample estimates:
## mean of x mean of y
## 4.236170 2.226016
#Below t.test() results gives us a positive number for 't', meaning, the life expectancy in woman is higher in non african countries when compared to african nations.
t.test(nonAfricanCountriesData$lifeExpF,africanCountriesData$lifeExpF)
##
## Welch Two Sample t-test
##
## data: nonAfricanCountriesData$lifeExpF and africanCountriesData$lifeExpF
## t = 13.235, df = 70.134, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 14.49443 19.63796
## sample estimates:
## mean of x mean of y
## 76.83846 59.77226
#Below t.test() results gives us a positive number for 't', meaning, the infant mortality rate per 1000 live births is higher in african countries when compared to non african nations.
t.test(africanCountriesData$infantMortality,nonAfricanCountriesData$infantMortality)
##
## Welch Two Sample t-test
##
## data: africanCountriesData$infantMortality and nonAfricanCountriesData$infantMortality
## t = 11.616, df = 65.906, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 39.19908 55.47145
## sample estimates:
## mean of x mean of y
## 65.32077 17.98550
Hypothesis (Preliminary Conclusions observing the dataset) : All the variables look to be dependent on each other, the higher the urban percentage (pcturban), the better GDP/ quality of living (ppgdp), the lower the fertility ratio (fertiltiy - number of children/woman) - which means better education on family planning/population control, higher the life expectancy for female - probability of deaths during pregnancy is lower as the fertility ratio is low and lower the infant mortality ratio (death of infants under age 1 per 1000 live births).
#2. Data wrangling: Please perform some basic transformations. They will need to make sense but could include column renaming, creating a subset of the data, replacing values, or creating new columns with derived data (for example - if it makes sense you could sum two columns together)
#We have already created four subset data frames -
#africanCountriesData
#nonAfricanCountriesData
#oecdCountriesData
#otherCountriesData
#Renaming the column names in both the data frames with meaningful names
colnames(africanCountriesData) <- c("COUNTRY_NAME","COUNTRY_REGION","COUNTRY_GROUP","NO_OF_CHILDREN_PER_WOMAN","GDP","FEMALE_LIFE_EXPECTANCY","URBAN_POPULATION_PERCENTAGE","INFANT_DEATH_RATE_PER_THOUSAND")
summary.data.frame(africanCountriesData)
## COUNTRY_NAME COUNTRY_REGION COUNTRY_GROUP
## Algeria : 1 Africa :53 africa:53
## Angola : 1 Asia : 0 oecd : 0
## Benin : 1 Caribbean : 0 other : 0
## Botswana : 1 Europe : 0
## Burkina Faso: 1 Latin Amer : 0
## Burundi : 1 North America: 0
## (Other) :47 (Other) : 0
## NO_OF_CHILDREN_PER_WOMAN GDP FEMALE_LIFE_EXPECTANCY
## Min. :1.590 Min. : 114.8 Min. :48.11
## 1st Qu.:3.174 1st Qu.: 509.0 1st Qu.:53.14
## Median :4.423 Median : 980.7 Median :58.59
## Mean :4.236 Mean : 2508.8 Mean :59.77
## 3rd Qu.:5.078 3rd Qu.: 2865.0 3rd Qu.:63.82
## Max. :6.925 Max. :16852.4 Max. :78.00
##
## URBAN_POPULATION_PERCENTAGE INFANT_DEATH_RATE_PER_THOUSAND
## Min. :11.00 Min. : 12.11
## 1st Qu.:28.00 1st Qu.: 46.94
## Median :40.00 Median : 67.02
## Mean :42.62 Mean : 65.32
## 3rd Qu.:59.00 3rd Qu.: 85.88
## Max. :86.00 Max. :123.94
## NA's :1
colnames(nonAfricanCountriesData) <- c("COUNTRY_NAME","COUNTRY_REGION","COUNTRY_GROUP","NO_OF_CHILDREN_PER_WOMAN","GDP","FEMALE_LIFE_EXPECTANCY","URBAN_POPULATION_PERCENTAGE","INFANT_DEATH_RATE_PER_THOUSAND")
summary.data.frame(nonAfricanCountriesData)
## COUNTRY_NAME COUNTRY_REGION COUNTRY_GROUP
## Afghanistan: 1 Asia :50 africa: 0
## Albania : 1 Europe :39 oecd : 31
## Anguilla : 1 Latin Amer :20 other :115
## Argentina : 1 Caribbean :17
## Armenia : 1 Oceania :17
## Aruba : 1 North America: 2
## (Other) :140 (Other) : 1
## NO_OF_CHILDREN_PER_WOMAN GDP FEMALE_LIFE_EXPECTANCY
## Min. :1.134 Min. : 499 Min. :49.49
## 1st Qu.:1.578 1st Qu.: 3005 1st Qu.:73.70
## Median :2.011 Median : 7568 Median :77.50
## Mean :2.226 Mean : 16825 Mean :76.84
## 3rd Qu.:2.498 3rd Qu.: 24279 3rd Qu.:81.26
## Max. :5.968 Max. :105095 Max. :87.12
##
## URBAN_POPULATION_PERCENTAGE INFANT_DEATH_RATE_PER_THOUSAND
## Min. : 13.00 Min. : 1.916
## 1st Qu.: 49.25 1st Qu.: 5.405
## Median : 67.00 Median : 13.063
## Mean : 63.49 Mean : 17.985
## 3rd Qu.: 81.75 3rd Qu.: 23.515
## Max. :100.00 Max. :124.535
## NA's :5
colnames(oecdCountriesData) <- c("COUNTRY_NAME","COUNTRY_REGION","COUNTRY_GROUP","NO_OF_CHILDREN_PER_WOMAN","GDP","FEMALE_LIFE_EXPECTANCY","URBAN_POPULATION_PERCENTAGE","INFANT_DEATH_RATE_PER_THOUSAND")
summary.data.frame(oecdCountriesData)
## COUNTRY_NAME COUNTRY_REGION COUNTRY_GROUP
## Australia : 1 Europe :22 africa: 0
## Austria : 1 Asia : 3 oecd :31
## Belgium : 1 Latin Amer : 2 other : 0
## Canada : 1 North America: 2
## Chile : 1 Oceania : 2
## Czech Republic: 1 Africa : 0
## (Other) :25 (Other) : 0
## NO_OF_CHILDREN_PER_WOMAN GDP FEMALE_LIFE_EXPECTANCY
## Min. :1.312 Min. : 9101 Min. :76.61
## 1st Qu.:1.476 1st Qu.: 20138 1st Qu.:81.34
## Median :1.794 Median : 39546 Median :82.79
## Mean :1.765 Mean : 37761 Mean :82.45
## 3rd Qu.:1.948 3rd Qu.: 46453 3rd Qu.:83.52
## Max. :2.909 Max. :105095 Max. :87.12
##
## URBAN_POPULATION_PERCENTAGE INFANT_DEATH_RATE_PER_THOUSAND
## Min. :49.00 Min. : 2.289
## 1st Qu.:68.00 1st Qu.: 3.346
## Median :78.00 Median : 3.914
## Mean :75.81 Mean : 4.890
## 3rd Qu.:85.00 3rd Qu.: 4.841
## Max. :97.00 Max. :19.901
##
colnames(otherCountriesData) <- c("COUNTRY_NAME","COUNTRY_REGION","COUNTRY_GROUP","NO_OF_CHILDREN_PER_WOMAN","GDP","FEMALE_LIFE_EXPECTANCY","URBAN_POPULATION_PERCENTAGE","INFANT_DEATH_RATE_PER_THOUSAND")
summary.data.frame(otherCountriesData)
## COUNTRY_NAME COUNTRY_REGION COUNTRY_GROUP
## Afghanistan: 1 Asia :47 africa: 0
## Albania : 1 Latin Amer :18 oecd : 0
## Anguilla : 1 Caribbean :17 other :115
## Argentina : 1 Europe :17
## Armenia : 1 Oceania :15
## Aruba : 1 NorthAtlantic: 1
## (Other) :109 (Other) : 0
## NO_OF_CHILDREN_PER_WOMAN GDP FEMALE_LIFE_EXPECTANCY
## Min. :1.134 Min. : 499 Min. :49.49
## 1st Qu.:1.650 1st Qu.: 2527 1st Qu.:72.47
## Median :2.171 Median : 5195 Median :76.37
## Mean :2.350 Mean :11181 Mean :75.33
## 3rd Qu.:2.611 3rd Qu.:12857 3rd Qu.:78.34
## Max. :5.968 Max. :92625 Max. :86.35
##
## URBAN_POPULATION_PERCENTAGE INFANT_DEATH_RATE_PER_THOUSAND
## Min. : 13.00 Min. : 1.916
## 1st Qu.: 44.50 1st Qu.: 10.558
## Median : 60.00 Median : 18.268
## Mean : 60.17 Mean : 21.676
## 3rd Qu.: 76.00 3rd Qu.: 26.098
## Max. :100.00 Max. :124.535
## NA's :5
colnames(UNStatistics) <- c("COUNTRY_NAME","COUNTRY_REGION","COUNTRY_GROUP","NO_OF_CHILDREN_PER_WOMAN","GDP","FEMALE_LIFE_EXPECTANCY","URBAN_POPULATION_PERCENTAGE","INFANT_DEATH_RATE_PER_THOUSAND")
summary.data.frame(UNStatistics)
## COUNTRY_NAME COUNTRY_REGION COUNTRY_GROUP
## Afghanistan : 1 Africa :53 africa: 53
## Albania : 1 Asia :50 oecd : 31
## Algeria : 1 Europe :39 other :115
## American Samoa: 1 Latin Amer:20 NA's : 14
## Angola : 1 Caribbean :17
## Anguilla : 1 (Other) :20
## (Other) :207 NA's :14
## NO_OF_CHILDREN_PER_WOMAN GDP FEMALE_LIFE_EXPECTANCY
## Min. :1.134 Min. : 114.8 Min. :48.11
## 1st Qu.:1.754 1st Qu.: 1283.0 1st Qu.:65.66
## Median :2.262 Median : 4684.5 Median :75.89
## Mean :2.761 Mean : 13012.0 Mean :72.29
## 3rd Qu.:3.545 3rd Qu.: 15520.5 3rd Qu.:79.58
## Max. :6.925 Max. :105095.4 Max. :87.12
## NA's :14 NA's :14 NA's :14
## URBAN_POPULATION_PERCENTAGE INFANT_DEATH_RATE_PER_THOUSAND
## Min. : 11.00 Min. : 1.916
## 1st Qu.: 39.00 1st Qu.: 7.019
## Median : 59.00 Median : 19.007
## Mean : 57.93 Mean : 29.440
## 3rd Qu.: 75.00 3rd Qu.: 44.477
## Max. :100.00 Max. :124.535
## NA's :14 NA's :6
#Creating new columns with derived data
#Adding a new column called "SERIAL_NUMBER"
africanCountriesData$SERIAL_NUMBER <- c(1:nrow(africanCountriesData))
#Get Rural population percentage by subtracting 100 from urban population
africanRuralPercentage <- as.integer(100 - africanCountriesData$URBAN_POPULATION_PERCENTAGE)
#Add RURAL_POPULATION_PERCENTAGE to the data frame
africanCountriesData$RURAL_POPULATION_PERCENTAGE <- africanRuralPercentage
#Find the GDP contribution by URBAN_POPULATION
africanUrbanGDPContribution <- africanCountriesData$GDP * (africanCountriesData$URBAN_POPULATION_PERCENTAGE / 100)
africanCountriesData$GDP_URBAN_CONTRIBUTION <- africanUrbanGDPContribution
#Find the GDP contribution by RURAL_POPULATION
africanRuralGDPContribution <- africanCountriesData$GDP * (africanCountriesData$RURAL_POPULATION_PERCENTAGE / 100)
africanCountriesData$GDP_RURAL_CONTRIBUTION <- africanRuralGDPContribution
#Arranging the columns to a meaningful order
africanCountriesData <- africanCountriesData[,c("SERIAL_NUMBER","COUNTRY_NAME","COUNTRY_REGION","COUNTRY_GROUP","NO_OF_CHILDREN_PER_WOMAN","GDP","FEMALE_LIFE_EXPECTANCY","URBAN_POPULATION_PERCENTAGE","RURAL_POPULATION_PERCENTAGE","GDP_URBAN_CONTRIBUTION","GDP_RURAL_CONTRIBUTION","INFANT_DEATH_RATE_PER_THOUSAND")]
names(africanCountriesData)
## [1] "SERIAL_NUMBER" "COUNTRY_NAME"
## [3] "COUNTRY_REGION" "COUNTRY_GROUP"
## [5] "NO_OF_CHILDREN_PER_WOMAN" "GDP"
## [7] "FEMALE_LIFE_EXPECTANCY" "URBAN_POPULATION_PERCENTAGE"
## [9] "RURAL_POPULATION_PERCENTAGE" "GDP_URBAN_CONTRIBUTION"
## [11] "GDP_RURAL_CONTRIBUTION" "INFANT_DEATH_RATE_PER_THOUSAND"
summary.data.frame(africanCountriesData)
## SERIAL_NUMBER COUNTRY_NAME COUNTRY_REGION COUNTRY_GROUP
## Min. : 1 Algeria : 1 Africa :53 africa:53
## 1st Qu.:14 Angola : 1 Asia : 0 oecd : 0
## Median :27 Benin : 1 Caribbean : 0 other : 0
## Mean :27 Botswana : 1 Europe : 0
## 3rd Qu.:40 Burkina Faso: 1 Latin Amer : 0
## Max. :53 Burundi : 1 North America: 0
## (Other) :47 (Other) : 0
## NO_OF_CHILDREN_PER_WOMAN GDP FEMALE_LIFE_EXPECTANCY
## Min. :1.590 Min. : 114.8 Min. :48.11
## 1st Qu.:3.174 1st Qu.: 509.0 1st Qu.:53.14
## Median :4.423 Median : 980.7 Median :58.59
## Mean :4.236 Mean : 2508.8 Mean :59.77
## 3rd Qu.:5.078 3rd Qu.: 2865.0 3rd Qu.:63.82
## Max. :6.925 Max. :16852.4 Max. :78.00
##
## URBAN_POPULATION_PERCENTAGE RURAL_POPULATION_PERCENTAGE
## Min. :11.00 Min. :14.00
## 1st Qu.:28.00 1st Qu.:41.00
## Median :40.00 Median :60.00
## Mean :42.62 Mean :57.38
## 3rd Qu.:59.00 3rd Qu.:72.00
## Max. :86.00 Max. :89.00
##
## GDP_URBAN_CONTRIBUTION GDP_RURAL_CONTRIBUTION
## Min. : 19.43 Min. : 71.18
## 1st Qu.: 140.32 1st Qu.: 296.89
## Median : 341.67 Median : 523.73
## Mean : 1381.27 Mean : 1127.48
## 3rd Qu.: 1679.01 3rd Qu.: 1232.72
## Max. :10723.17 Max. :10111.44
##
## INFANT_DEATH_RATE_PER_THOUSAND
## Min. : 12.11
## 1st Qu.: 46.94
## Median : 67.02
## Mean : 65.32
## 3rd Qu.: 85.88
## Max. :123.94
## NA's :1
#---------------------------------------------
#---------------------------------------------
#Creating new columns with derived data for 'nonAfricanCountriesData'
#Adding a new column called "SERIAL_NUMBER"
nonAfricanCountriesData$SERIAL_NUMBER <- c(1:nrow(nonAfricanCountriesData))
#Get Rural population percentage by subtracting 100 from urban population
nonAfricanRuralPercentage <- as.integer(100 - nonAfricanCountriesData$URBAN_POPULATION_PERCENTAGE)
#Add RURAL_POPULATION_PERCENTAGE to the data frame
nonAfricanCountriesData$RURAL_POPULATION_PERCENTAGE <- nonAfricanRuralPercentage
#Find the GDP contribution by URBAN_POPULATION
nonAfricanUrbanGDPContribution <- nonAfricanCountriesData$GDP * (nonAfricanCountriesData$URBAN_POPULATION_PERCENTAGE / 100)
nonAfricanCountriesData$GDP_URBAN_CONTRIBUTION <- nonAfricanUrbanGDPContribution
#Find the GDP contribution by RURAL_POPULATION
nonAfricanRuralGDPContribution <- nonAfricanCountriesData$GDP * (nonAfricanCountriesData$RURAL_POPULATION_PERCENTAGE / 100)
nonAfricanCountriesData$GDP_RURAL_CONTRIBUTION <- nonAfricanRuralGDPContribution
#Arranging the columns to a meaningful order
nonAfricanCountriesData <- nonAfricanCountriesData[,c("SERIAL_NUMBER","COUNTRY_NAME","COUNTRY_REGION","COUNTRY_GROUP","NO_OF_CHILDREN_PER_WOMAN","GDP","FEMALE_LIFE_EXPECTANCY","URBAN_POPULATION_PERCENTAGE","RURAL_POPULATION_PERCENTAGE","GDP_URBAN_CONTRIBUTION","GDP_RURAL_CONTRIBUTION","INFANT_DEATH_RATE_PER_THOUSAND")]
summary.data.frame(nonAfricanCountriesData)
## SERIAL_NUMBER COUNTRY_NAME COUNTRY_REGION COUNTRY_GROUP
## Min. : 1.00 Afghanistan: 1 Asia :50 africa: 0
## 1st Qu.: 37.25 Albania : 1 Europe :39 oecd : 31
## Median : 73.50 Anguilla : 1 Latin Amer :20 other :115
## Mean : 73.50 Argentina : 1 Caribbean :17
## 3rd Qu.:109.75 Armenia : 1 Oceania :17
## Max. :146.00 Aruba : 1 North America: 2
## (Other) :140 (Other) : 1
## NO_OF_CHILDREN_PER_WOMAN GDP FEMALE_LIFE_EXPECTANCY
## Min. :1.134 Min. : 499 Min. :49.49
## 1st Qu.:1.578 1st Qu.: 3005 1st Qu.:73.70
## Median :2.011 Median : 7568 Median :77.50
## Mean :2.226 Mean : 16825 Mean :76.84
## 3rd Qu.:2.498 3rd Qu.: 24279 3rd Qu.:81.26
## Max. :5.968 Max. :105095 Max. :87.12
##
## URBAN_POPULATION_PERCENTAGE RURAL_POPULATION_PERCENTAGE
## Min. : 13.00 Min. : 0.00
## 1st Qu.: 49.25 1st Qu.:18.25
## Median : 67.00 Median :33.00
## Mean : 63.49 Mean :36.51
## 3rd Qu.: 81.75 3rd Qu.:50.75
## Max. :100.00 Max. :87.00
##
## GDP_URBAN_CONTRIBUTION GDP_RURAL_CONTRIBUTION
## Min. : 101.6 Min. : 0.0
## 1st Qu.: 1473.0 1st Qu.: 968.2
## Median : 4960.0 Median : 2052.5
## Mean :13273.0 Mean : 3551.7
## 3rd Qu.:18805.6 3rd Qu.: 4513.4
## Max. :92624.7 Max. :17908.9
##
## INFANT_DEATH_RATE_PER_THOUSAND
## Min. : 1.916
## 1st Qu.: 5.405
## Median : 13.063
## Mean : 17.985
## 3rd Qu.: 23.515
## Max. :124.535
## NA's :5
#---------------------------------------------
#---------------------------------------------
#Creating new columns with derived data for 'oecdCountriesData'
#Adding a new column called "SERIAL_NUMBER"
oecdCountriesData$SERIAL_NUMBER <- c(1:nrow(oecdCountriesData))
#Get Rural population percentage by subtracting 100 from urban population
oecdCountriesRuralPercentage <- as.integer(100 - oecdCountriesData$URBAN_POPULATION_PERCENTAGE)
oecdCountriesRuralPercentage
## [1] 11 32 3 19 11 26 13 30 15 14 26 38 32 38 8 31 33 15 22 17 14 20 39
## [24] 39 45 51 15 26 30 20 17
#Add RURAL_POPULATION_PERCENTAGE to the data frame
oecdCountriesData$RURAL_POPULATION_PERCENTAGE <- oecdCountriesRuralPercentage
#Find the GDP contribution by URBAN_POPULATION
oecdUrbanGDPContribution <- oecdCountriesData$GDP * (oecdCountriesData$URBAN_POPULATION_PERCENTAGE / 100)
oecdCountriesData$GDP_URBAN_CONTRIBUTION <- oecdUrbanGDPContribution
#Find the GDP contribution by RURAL_POPULATION
oecdRuralGDPContribution <- oecdCountriesData$GDP * (oecdCountriesData$RURAL_POPULATION_PERCENTAGE / 100)
oecdCountriesData$GDP_RURAL_CONTRIBUTION <- oecdRuralGDPContribution
#Arranging the columns to a meaningful order
oecdCountriesData <- oecdCountriesData[,c("SERIAL_NUMBER","COUNTRY_NAME","COUNTRY_REGION","COUNTRY_GROUP","NO_OF_CHILDREN_PER_WOMAN","GDP","FEMALE_LIFE_EXPECTANCY","URBAN_POPULATION_PERCENTAGE","RURAL_POPULATION_PERCENTAGE","GDP_URBAN_CONTRIBUTION","GDP_RURAL_CONTRIBUTION","INFANT_DEATH_RATE_PER_THOUSAND")]
summary.data.frame(oecdCountriesData)
## SERIAL_NUMBER COUNTRY_NAME COUNTRY_REGION COUNTRY_GROUP
## Min. : 1.0 Australia : 1 Europe :22 africa: 0
## 1st Qu.: 8.5 Austria : 1 Asia : 3 oecd :31
## Median :16.0 Belgium : 1 Latin Amer : 2 other : 0
## Mean :16.0 Canada : 1 North America: 2
## 3rd Qu.:23.5 Chile : 1 Oceania : 2
## Max. :31.0 Czech Republic: 1 Africa : 0
## (Other) :25 (Other) : 0
## NO_OF_CHILDREN_PER_WOMAN GDP FEMALE_LIFE_EXPECTANCY
## Min. :1.312 Min. : 9101 Min. :76.61
## 1st Qu.:1.476 1st Qu.: 20138 1st Qu.:81.34
## Median :1.794 Median : 39546 Median :82.79
## Mean :1.765 Mean : 37761 Mean :82.45
## 3rd Qu.:1.948 3rd Qu.: 46453 3rd Qu.:83.52
## Max. :2.909 Max. :105095 Max. :87.12
##
## URBAN_POPULATION_PERCENTAGE RURAL_POPULATION_PERCENTAGE
## Min. :49.00 Min. : 3.00
## 1st Qu.:68.00 1st Qu.:15.00
## Median :78.00 Median :22.00
## Mean :75.81 Mean :24.19
## 3rd Qu.:85.00 3rd Qu.:32.00
## Max. :97.00 Max. :51.00
##
## GDP_URBAN_CONTRIBUTION GDP_RURAL_CONTRIBUTION
## Min. : 7067 Min. : 1308
## 1st Qu.:12200 1st Qu.: 4657
## Median :28904 Median : 7265
## Mean :29608 Mean : 8153
## 3rd Qu.:38784 3rd Qu.:10432
## Max. :89331 Max. :17909
##
## INFANT_DEATH_RATE_PER_THOUSAND
## Min. : 2.289
## 1st Qu.: 3.346
## Median : 3.914
## Mean : 4.890
## 3rd Qu.: 4.841
## Max. :19.901
##
#---------------------------------------------
#---------------------------------------------
#Creating new columns with derived data for 'otherCountriesData'
#Adding a new column called "SERIAL_NUMBER"
otherCountriesData$SERIAL_NUMBER <- c(1:nrow(otherCountriesData))
#Get Rural population percentage by subtracting 100 from urban population
otherCountriesRuralPercentage <- as.integer(100 - otherCountriesData$URBAN_POPULATION_PERCENTAGE)
#Add RURAL_POPULATION_PERCENTAGE to the data frame
otherCountriesData$RURAL_POPULATION_PERCENTAGE <- otherCountriesRuralPercentage
#Find the GDP contribution by URBAN_POPULATION
otherUrbanGDPContribution <- otherCountriesData$GDP * (otherCountriesData$URBAN_POPULATION_PERCENTAGE / 100)
otherCountriesData$GDP_URBAN_CONTRIBUTION <- otherUrbanGDPContribution
#Find the GDP contribution by RURAL_POPULATION
otherRuralGDPContribution <- otherCountriesData$GDP * (otherCountriesData$RURAL_POPULATION_PERCENTAGE / 100)
otherCountriesData$GDP_RURAL_CONTRIBUTION <- otherRuralGDPContribution
#Arranging the columns to a meaningful order
otherCountriesData <- otherCountriesData[,c("SERIAL_NUMBER","COUNTRY_NAME","COUNTRY_REGION","COUNTRY_GROUP","NO_OF_CHILDREN_PER_WOMAN","GDP","FEMALE_LIFE_EXPECTANCY","URBAN_POPULATION_PERCENTAGE","RURAL_POPULATION_PERCENTAGE","GDP_URBAN_CONTRIBUTION","GDP_RURAL_CONTRIBUTION","INFANT_DEATH_RATE_PER_THOUSAND")]
summary.data.frame(otherCountriesData)
## SERIAL_NUMBER COUNTRY_NAME COUNTRY_REGION COUNTRY_GROUP
## Min. : 1.0 Afghanistan: 1 Asia :47 africa: 0
## 1st Qu.: 29.5 Albania : 1 Latin Amer :18 oecd : 0
## Median : 58.0 Anguilla : 1 Caribbean :17 other :115
## Mean : 58.0 Argentina : 1 Europe :17
## 3rd Qu.: 86.5 Armenia : 1 Oceania :15
## Max. :115.0 Aruba : 1 NorthAtlantic: 1
## (Other) :109 (Other) : 0
## NO_OF_CHILDREN_PER_WOMAN GDP FEMALE_LIFE_EXPECTANCY
## Min. :1.134 Min. : 499 Min. :49.49
## 1st Qu.:1.650 1st Qu.: 2527 1st Qu.:72.47
## Median :2.171 Median : 5195 Median :76.37
## Mean :2.350 Mean :11181 Mean :75.33
## 3rd Qu.:2.611 3rd Qu.:12857 3rd Qu.:78.34
## Max. :5.968 Max. :92625 Max. :86.35
##
## URBAN_POPULATION_PERCENTAGE RURAL_POPULATION_PERCENTAGE
## Min. : 13.00 Min. : 0.00
## 1st Qu.: 44.50 1st Qu.:24.00
## Median : 60.00 Median :40.00
## Mean : 60.17 Mean :39.83
## 3rd Qu.: 76.00 3rd Qu.:55.50
## Max. :100.00 Max. :87.00
##
## GDP_URBAN_CONTRIBUTION GDP_RURAL_CONTRIBUTION
## Min. : 101.6 Min. : 0
## 1st Qu.: 958.7 1st Qu.: 834
## Median : 2869.0 Median : 1516
## Mean : 8869.6 Mean : 2311
## 3rd Qu.: 9185.8 3rd Qu.: 2695
## Max. :92624.7 Max. :15187
##
## INFANT_DEATH_RATE_PER_THOUSAND
## Min. : 1.916
## 1st Qu.: 10.558
## Median : 18.268
## Mean : 21.676
## 3rd Qu.: 26.098
## Max. :124.535
## NA's :5
#---------------------------------------------
#---------------------------------------------
#Creating new columns with derived data for 'UNStatistics'
#Adding a new column called "SERIAL_NUMBER"
UNStatistics$SERIAL_NUMBER <- c(1:nrow(UNStatistics))
#Get Rural population percentage by subtracting 100 from urban population
UNCountriesRuralPercentage <- as.integer(100 - UNStatistics$URBAN_POPULATION_PERCENTAGE)
#Add RURAL_POPULATION_PERCENTAGE to the data frame
UNStatistics$RURAL_POPULATION_PERCENTAGE <- UNCountriesRuralPercentage
#Find the GDP contribution by URBAN_POPULATION
UNCountriesUrbanGDPContribution <- UNStatistics$GDP * (UNStatistics$URBAN_POPULATION_PERCENTAGE / 100)
UNStatistics$GDP_URBAN_CONTRIBUTION <- UNCountriesUrbanGDPContribution
#Find the GDP contribution by RURAL_POPULATION
UNCountriesRuralGDPContribution <- UNStatistics$GDP * (UNStatistics$RURAL_POPULATION_PERCENTAGE / 100)
UNStatistics$GDP_RURAL_CONTRIBUTION <- UNCountriesRuralGDPContribution
#Arranging the columns to a meaningful order
UNStatistics <- UNStatistics[,c("SERIAL_NUMBER","COUNTRY_NAME","COUNTRY_REGION","COUNTRY_GROUP","NO_OF_CHILDREN_PER_WOMAN","GDP","FEMALE_LIFE_EXPECTANCY","URBAN_POPULATION_PERCENTAGE","RURAL_POPULATION_PERCENTAGE","GDP_URBAN_CONTRIBUTION","GDP_RURAL_CONTRIBUTION","INFANT_DEATH_RATE_PER_THOUSAND")]
UNStatistics
## SERIAL_NUMBER COUNTRY_NAME COUNTRY_REGION
## 1 1 Afghanistan Asia
## 2 2 Albania Europe
## 3 3 Algeria Africa
## 4 4 American Samoa <NA>
## 5 5 Angola Africa
## 6 6 Anguilla Caribbean
## 7 7 Argentina Latin Amer
## 8 8 Armenia Asia
## 9 9 Aruba Caribbean
## 10 10 Australia Oceania
## 11 11 Austria Europe
## 12 12 Azerbaijan Asia
## 13 13 Bahamas Caribbean
## 14 14 Bahrain Asia
## 15 15 Bangladesh Asia
## 16 16 Barbados Caribbean
## 17 17 Belarus Europe
## 18 18 Belgium Europe
## 19 19 Belize Latin Amer
## 20 20 Benin Africa
## 21 21 Bermuda Caribbean
## 22 22 Bhutan Asia
## 23 23 Bolivia Latin Amer
## 24 24 Bosnia and Herzegovina Europe
## 25 25 Botswana Africa
## 26 26 Brazil Latin Amer
## 27 27 Brunei Darussalam Asia
## 28 28 Bulgaria Europe
## 29 29 Burkina Faso Africa
## 30 30 Burundi Africa
## 31 31 Cambodia Asia
## 32 32 Cameroon Africa
## 33 33 Canada North America
## 34 34 Cape Verde Africa
## 35 35 Cayman Islands Caribbean
## 36 36 Central African Republic Africa
## 37 37 Chad Africa
## 38 38 Channel Islands <NA>
## 39 39 Chile Latin Amer
## 40 40 China Asia
## 41 41 Colombia Latin Amer
## 42 42 Comoros Africa
## 43 43 Congo Africa
## 44 44 Cook Islands Oceania
## 45 45 Costa Rica Latin Amer
## 46 46 Cote dIvoire Africa
## 47 47 Croatia Europe
## 48 48 Cuba Caribbean
## 49 49 Cyprus Asia
## 50 50 Czech Republic Europe
## 51 51 Democratic Republic of the Congo Africa
## 52 52 Denmark Europe
## 53 53 Djibouti Africa
## 54 54 Dominica Caribbean
## 55 55 Dominican Republic Caribbean
## 56 56 Timor Leste Asia
## 57 57 Ecuador Latin Amer
## 58 58 Egypt Africa
## 59 59 El Salvador Latin Amer
## 60 60 Equatorial Guinea Africa
## 61 61 Eritrea Africa
## 62 62 Estonia Europe
## 63 63 Ethiopia Africa
## 64 64 Fiji Oceania
## 65 65 Finland Europe
## 66 66 France Europe
## 67 67 French Guiana <NA>
## 68 68 French Polynesia Oceania
## 69 69 Gabon Africa
## 70 70 Gambia Africa
## 71 71 Georgia Asia
## 72 72 Germany Europe
## 73 73 Ghana Africa
## 74 74 Greece Europe
## 75 75 Greenland NorthAtlantic
## 76 76 Grenada Caribbean
## 77 77 Guadeloupe <NA>
## 78 78 Guam <NA>
## 79 79 Guatemala Latin Amer
## 80 80 Guinea Africa
## 81 81 Guinea-Bissau Africa
## 82 82 Guyana Latin Amer
## 83 83 Haiti Caribbean
## 84 84 Honduras Latin Amer
## 85 85 Hong Kong Asia
## 86 86 Hungary Europe
## 87 87 Iceland Europe
## 88 88 India Asia
## 89 89 Indonesia Asia
## 90 90 Iran Asia
## 91 91 Iraq Asia
## 92 92 Ireland Europe
## 93 93 Israel Asia
## 94 94 Italy Europe
## 95 95 Jamaica Caribbean
## 96 96 Japan Asia
## 97 97 Jordan Asia
## 98 98 Kazakhstan Asia
## 99 99 Kenya Africa
## 100 100 Kiribati Oceania
## 101 101 Kuwait Asia
## 102 102 Kyrgyzstan Asia
## 103 103 Laos Asia
## 104 104 Latvia Europe
## 105 105 Lebanon Asia
## 106 106 Lesotho Africa
## 107 107 Liberia Africa
## 108 108 Libya Africa
## 109 109 Lithuania Europe
## 110 110 Luxembourg Europe
## 111 111 Macao Asia
## 112 112 Madagascar Africa
## 113 113 Malawi Africa
## 114 114 Malaysia Asia
## 115 115 Maldives Asia
## 116 116 Mali Africa
## 117 117 Malta Europe
## 118 118 Marshall Islands Oceania
## 119 119 Martinique <NA>
## 120 120 Mauritania Africa
## 121 121 Mauritius Africa
## 122 122 Mayotte <NA>
## 123 123 Mexico Latin Amer
## 124 124 Micronesia Oceania
## 125 125 Moldova Europe
## 126 126 Mongolia Asia
## 127 127 Montenegro Europe
## 128 128 Morocco Africa
## 129 129 Mozambique Africa
## 130 130 Myanmar Asia
## 131 131 Namibia Africa
## 132 132 Nauru Oceania
## 133 133 Nepal Asia
## 134 134 Neth Antilles Caribbean
## 135 135 Netherlands Europe
## 136 136 New Caledonia Oceania
## 137 137 New Zealand Oceania
## 138 138 Nicaragua Latin Amer
## 139 139 Niger Africa
## 140 140 Nigeria Africa
## 141 141 Niue <NA>
## 142 142 North Korea Asia
## 143 143 Northern Mariana Islands <NA>
## 144 144 Norway Europe
## 145 145 Oman Asia
## 146 146 Pakistan Asia
## 147 147 Palau Oceania
## 148 148 Palestinian Territory Asia
## 149 149 Panama Latin Amer
## 150 150 Papua New Guinea Oceania
## 151 151 Paraguay Latin Amer
## 152 152 Peru Latin Amer
## 153 153 Philippines Asia
## 154 154 Poland Europe
## 155 155 Portugal Europe
## 156 156 Puerto Rico Caribbean
## 157 157 Qatar Asia
## 158 158 Republic of Korea Asia
## 159 159 Reunion <NA>
## 160 160 Romania Europe
## 161 161 Russian Federation Europe
## 162 162 Rwanda Africa
## 163 163 Saint Lucia Caribbean
## 164 164 Samoa Oceania
## 165 165 Sao Tome and Principe Africa
## 166 166 Saudi Arabia Asia
## 167 167 Senegal Africa
## 168 168 Serbia Europe
## 169 169 Seychelles Africa
## 170 170 Sierra Leone Africa
## 171 171 Singapore Asia
## 172 172 Slovakia Europe
## 173 173 Slovenia Europe
## 174 174 Solomon Islands Oceania
## 175 175 Somalia Africa
## 176 176 South Africa Africa
## 177 177 Spain Europe
## 178 178 Sri Lanka Asia
## 179 179 St Vincent and Grenadines Caribbean
## 180 180 Sudan Africa
## 181 181 Suriname Latin Amer
## 182 182 Swaziland Africa
## 183 183 Sweden Europe
## 184 184 Switzerland Europe
## 185 185 Syria Asia
## 186 186 Tajikistan Asia
## 187 187 Tanzania Africa
## 188 188 TFYR Macedonia Europe
## 189 189 Thailand Asia
## 190 190 Togo Africa
## 191 191 Tokelau <NA>
## 192 192 Tonga Oceania
## 193 193 Trinidad and Tobago Caribbean
## 194 194 Tunisia Africa
## 195 195 Turkey Asia
## 196 196 Turkmenistan Asia
## 197 197 Tuvalu Oceania
## 198 198 Uganda Africa
## 199 199 Ukraine Europe
## 200 200 United Arab Emirates Asia
## 201 201 United Kingdom Europe
## 202 202 United States North America
## 203 203 United States Virgin Islands <NA>
## 204 204 Uruguay Latin Amer
## 205 205 Uzbekistan Asia
## 206 206 Vanuatu Oceania
## 207 207 Venezuela Latin Amer
## 208 208 Viet Nam Asia
## 209 209 Wallis and Futuna Islands <NA>
## 210 210 Western Sahara <NA>
## 211 211 Yemen Asia
## 212 212 Zambia Africa
## 213 213 Zimbabwe Africa
## COUNTRY_GROUP NO_OF_CHILDREN_PER_WOMAN GDP FEMALE_LIFE_EXPECTANCY
## 1 other 5.968000 499.0 49.49000
## 2 other 1.525000 3677.2 80.40000
## 3 africa 2.142000 4473.0 75.00000
## 4 <NA> NA NA NA
## 5 africa 5.135000 4321.9 53.17000
## 6 other 2.000000 13750.1 81.10000
## 7 other 2.172000 9162.1 79.89000
## 8 other 1.735000 3030.7 77.33000
## 9 other 1.671000 22851.5 77.75000
## 10 oecd 1.949000 57118.9 84.27000
## 11 oecd 1.346000 45158.8 83.55000
## 12 other 2.148000 5637.6 73.66000
## 13 other 1.877000 22461.6 78.85000
## 14 other 2.430000 18184.1 76.06000
## 15 other 2.157000 670.4 70.23000
## 16 other 1.575000 14497.3 80.26000
## 17 other 1.479000 5702.0 76.37000
## 18 oecd 1.835000 43814.8 82.81000
## 19 other 2.679000 4495.8 77.81000
## 20 africa 5.078000 741.1 58.66000
## 21 other 1.760000 92624.7 82.30000
## 22 other 2.258000 2047.2 69.84000
## 23 other 3.229000 1977.9 69.40000
## 24 other 1.134000 4477.7 78.40000
## 25 africa 2.617000 7402.9 51.34000
## 26 other 1.800000 10715.6 77.41000
## 27 other 1.984000 32647.6 80.64000
## 28 other 1.546000 6365.1 77.12000
## 29 africa 5.750000 519.7 57.02000
## 30 africa 4.051000 176.6 52.58000
## 31 other 2.422000 797.2 65.10000
## 32 africa 4.287000 1206.6 53.56000
## 33 oecd 1.691000 46360.9 83.49000
## 34 africa 2.279000 3244.0 77.70000
## 35 other 1.600000 57047.9 83.80000
## 36 africa 4.423000 450.8 51.30000
## 37 africa 5.737000 727.4 51.61000
## 38 <NA> NA NA NA
## 39 oecd 1.832000 11887.7 82.35000
## 40 other 1.559000 4354.0 75.61000
## 41 other 2.293000 6222.8 77.69000
## 42 africa 4.742000 736.6 63.18000
## 43 africa 4.442000 2665.1 59.33000
## 44 other 2.530806 12212.1 76.24547
## 45 other 1.812000 7703.8 81.99000
## 46 africa 4.224000 1154.1 57.71000
## 47 other 1.501000 13819.5 80.37000
## 48 other 1.451000 5704.4 81.33000
## 49 other 1.458000 28364.3 82.14000
## 50 oecd 1.501000 18838.8 81.00000
## 51 africa 5.485000 200.6 50.56000
## 52 oecd 1.885000 55830.2 81.37000
## 53 africa 3.589000 1282.6 60.04000
## 54 other 3.000000 7020.8 78.20000
## 55 other 2.490000 5195.4 76.57000
## 56 other 5.918000 706.1 64.20000
## 57 other 2.393000 4072.6 78.91000
## 58 africa 2.636000 2653.7 75.52000
## 59 other 2.171000 3425.6 77.09000
## 60 africa 4.980000 16852.4 52.91000
## 61 africa 4.243000 429.1 64.41000
## 62 oecd 1.702000 14135.4 79.95000
## 63 africa 3.848000 324.6 61.59000
## 64 other 2.602000 3545.7 72.27000
## 65 oecd 1.875000 44501.7 83.28000
## 66 oecd 1.987000 39545.9 84.90000
## 67 <NA> NA NA NA
## 68 other 2.033000 24669.0 78.07000
## 69 africa 3.195000 12468.8 64.32000
## 70 africa 4.689000 579.1 60.30000
## 71 other 1.528000 2680.3 77.31000
## 72 oecd 1.457000 39857.1 82.99000
## 73 africa 3.988000 1333.2 65.80000
## 74 oecd 1.540000 26503.8 82.58000
## 75 other 2.217000 35292.7 71.60000
## 76 other 2.171000 7429.0 77.72000
## 77 <NA> NA NA NA
## 78 <NA> NA NA NA
## 79 other 3.840000 2882.3 75.10000
## 80 africa 5.032000 427.5 56.39000
## 81 africa 4.877000 539.4 50.40000
## 82 other 2.190000 2996.0 73.45000
## 83 other 3.159000 612.7 63.87000
## 84 other 2.996000 2026.2 75.92000
## 85 other 1.137000 31823.7 86.35000
## 86 oecd 1.430000 12884.0 78.47000
## 87 other 2.098000 39278.0 83.77000
## 88 other 2.538000 1406.4 67.62000
## 89 other 2.055000 2949.3 71.80000
## 90 other 1.587000 5227.1 75.28000
## 91 other 4.535000 888.5 72.60000
## 92 oecd 2.097000 46220.3 83.17000
## 93 oecd 2.909000 29311.6 84.19000
## 94 oecd 1.476000 33877.1 84.62000
## 95 other 2.262000 4899.0 75.98000
## 96 oecd 1.418000 43140.9 87.12000
## 97 other 2.889000 4445.3 75.17000
## 98 other 2.481000 9166.7 72.84000
## 99 africa 4.623000 801.8 59.16000
## 100 other 3.500000 1468.2 63.10000
## 101 other 2.251000 45430.4 75.89000
## 102 other 2.621000 865.4 72.36000
## 103 other 2.543000 1047.6 69.42000
## 104 other 1.506000 10663.0 78.51000
## 105 other 1.764000 9283.7 75.07000
## 106 africa 3.051000 980.7 48.11000
## 107 africa 5.038000 218.6 58.59000
## 108 africa 2.410000 11320.8 77.86000
## 109 other 1.495000 10975.5 78.28000
## 110 oecd 1.683000 105095.4 82.67000
## 111 other 1.163000 49990.2 83.80000
## 112 africa 4.493000 421.9 68.61000
## 113 africa 5.968000 357.4 55.17000
## 114 other 2.572000 8372.8 76.86000
## 115 other 1.668000 4684.5 78.70000
## 116 africa 6.117000 598.8 53.14000
## 117 other 1.284000 19599.2 82.29000
## 118 other 4.384466 3069.4 70.60000
## 119 <NA> NA NA NA
## 120 africa 4.361000 1131.1 60.95000
## 121 africa 1.590000 7488.3 76.89000
## 122 <NA> NA NA NA
## 123 oecd 2.227000 9100.7 79.64000
## 124 other 3.307000 2678.2 70.17000
## 125 other 1.450000 1625.8 73.48000
## 126 other 2.446000 2246.7 72.83000
## 127 other 1.630000 6509.8 77.37000
## 128 africa 2.183000 2865.0 74.86000
## 129 africa 4.713000 407.5 51.81000
## 130 other 1.939000 876.2 67.87000
## 131 africa 3.055000 5124.7 63.04000
## 132 other 3.300000 6190.1 57.10000
## 133 other 2.587000 534.7 70.05000
## 134 other 1.900000 20321.1 79.86000
## 135 oecd 1.794000 46909.7 82.79000
## 136 other 2.091000 35319.5 80.49000
## 137 oecd 2.135000 32372.1 82.77000
## 138 other 2.500000 1131.9 77.45000
## 139 africa 6.925000 357.7 55.77000
## 140 africa 5.431000 1239.8 53.38000
## 141 <NA> NA NA NA
## 142 other 1.988000 504.0 72.12000
## 143 <NA> NA NA NA
## 144 oecd 1.948000 84588.7 83.47000
## 145 other 2.146000 20791.0 76.44000
## 146 other 3.201000 1003.2 66.88000
## 147 other 2.000000 10821.8 72.10000
## 148 other 4.270000 1819.5 74.81000
## 149 other 2.409000 7614.0 79.07000
## 150 other 3.799000 1428.4 65.52000
## 151 other 2.858000 2771.1 74.91000
## 152 other 2.410000 5410.7 76.90000
## 153 other 3.050000 2140.1 72.57000
## 154 oecd 1.415000 12263.2 80.56000
## 155 oecd 1.312000 21437.6 82.76000
## 156 other 1.757000 26461.0 83.20000
## 157 other 2.204000 72397.9 78.24000
## 158 other 1.389000 21052.2 83.95000
## 159 <NA> NA NA NA
## 160 other 1.428000 7522.4 77.95000
## 161 other 1.529000 10351.4 75.01000
## 162 africa 5.282000 532.3 57.13000
## 163 other 1.907000 6677.1 77.54000
## 164 other 3.763000 3343.3 76.02000
## 165 africa 3.488000 1283.3 66.48000
## 166 other 2.639000 15835.9 75.57000
## 167 africa 4.605000 1032.7 60.92000
## 168 other 1.562000 5123.2 77.05000
## 169 africa 2.340000 11450.6 78.00000
## 170 africa 4.728000 351.7 48.87000
## 171 other 1.367000 43783.1 83.71000
## 172 oecd 1.372000 15976.0 79.53000
## 173 oecd 1.477000 23109.8 82.84000
## 174 other 4.041000 1193.5 70.00000
## 175 africa 6.283000 114.8 53.38000
## 176 africa 2.383000 7254.8 54.09000
## 177 other 1.504000 30542.8 84.76000
## 178 other 2.235000 2375.3 78.40000
## 179 other 1.995000 6171.7 74.73000
## 180 africa 4.225000 1824.9 63.82000
## 181 other 2.266000 7018.0 74.18000
## 182 africa 3.174000 3311.2 48.54000
## 183 oecd 1.925000 48906.2 83.65000
## 184 oecd 1.536000 68880.2 84.71000
## 185 other 2.772000 2931.5 77.72000
## 186 other 3.162000 816.0 71.23000
## 187 africa 5.499000 516.0 60.31000
## 188 other 1.397000 4434.5 77.14000
## 189 other 1.528000 4612.8 77.76000
## 190 africa 3.864000 524.6 59.40000
## 191 <NA> NA NA NA
## 192 other 3.783000 3543.1 75.38000
## 193 other 1.632000 15205.1 73.82000
## 194 africa 1.909000 4222.1 77.05000
## 195 oecd 2.022000 10095.1 76.61000
## 196 other 2.316000 4587.5 69.40000
## 197 other 3.700000 3187.2 65.10000
## 198 africa 5.901000 509.0 55.44000
## 199 other 1.483000 3035.0 74.58000
## 200 other 1.707000 39624.7 78.02000
## 201 oecd 1.867000 36326.8 82.42000
## 202 oecd 2.077000 46545.9 81.31000
## 203 <NA> NA NA NA
## 204 other 2.043000 11952.4 80.66000
## 205 other 2.264000 1427.3 71.90000
## 206 other 3.750000 2963.5 73.58000
## 207 other 2.391000 13502.7 77.73000
## 208 other 1.750000 1182.7 77.44000
## 209 <NA> NA NA NA
## 210 <NA> NA NA NA
## 211 other 4.938000 1437.2 67.66000
## 212 africa 6.300000 1237.8 50.04000
## 213 africa 3.109000 573.1 52.72000
## URBAN_POPULATION_PERCENTAGE RURAL_POPULATION_PERCENTAGE
## 1 23 77
## 2 53 47
## 3 67 33
## 4 NA NA
## 5 59 41
## 6 100 0
## 7 93 7
## 8 64 36
## 9 47 53
## 10 89 11
## 11 68 32
## 12 52 48
## 13 84 16
## 14 89 11
## 15 29 71
## 16 45 55
## 17 75 25
## 18 97 3
## 19 53 47
## 20 42 58
## 21 100 0
## 22 35 65
## 23 67 33
## 24 49 51
## 25 62 38
## 26 87 13
## 27 76 24
## 28 72 28
## 29 27 73
## 30 11 89
## 31 20 80
## 32 59 41
## 33 81 19
## 34 62 38
## 35 100 0
## 36 39 61
## 37 28 72
## 38 NA NA
## 39 89 11
## 40 48 52
## 41 75 25
## 42 28 72
## 43 63 37
## 44 76 24
## 45 65 35
## 46 51 49
## 47 58 42
## 48 75 25
## 49 71 29
## 50 74 26
## 51 36 64
## 52 87 13
## 53 76 24
## 54 67 33
## 55 70 30
## 56 29 71
## 57 68 32
## 58 44 56
## 59 65 35
## 60 40 60
## 61 22 78
## 62 70 30
## 63 17 83
## 64 52 48
## 65 85 15
## 66 86 14
## 67 NA NA
## 68 51 49
## 69 86 14
## 70 59 41
## 71 53 47
## 72 74 26
## 73 52 48
## 74 62 38
## 75 84 16
## 76 40 60
## 77 NA NA
## 78 NA NA
## 79 50 50
## 80 36 64
## 81 30 70
## 82 29 71
## 83 54 46
## 84 52 48
## 85 100 0
## 86 68 32
## 87 94 6
## 88 30 70
## 89 45 55
## 90 71 29
## 91 66 34
## 92 62 38
## 93 92 8
## 94 69 31
## 95 52 48
## 96 67 33
## 97 79 21
## 98 59 41
## 99 23 77
## 100 44 56
## 101 98 2
## 102 35 65
## 103 34 66
## 104 68 32
## 105 87 13
## 106 28 72
## 107 48 52
## 108 78 22
## 109 67 33
## 110 85 15
## 111 100 0
## 112 31 69
## 113 20 80
## 114 73 27
## 115 41 59
## 116 37 63
## 117 95 5
## 118 72 28
## 119 NA NA
## 120 42 58
## 121 42 58
## 122 NA NA
## 123 78 22
## 124 23 77
## 125 48 52
## 126 63 37
## 127 61 39
## 128 59 41
## 129 39 61
## 130 34 66
## 131 39 61
## 132 100 0
## 133 19 81
## 134 93 7
## 135 83 17
## 136 57 43
## 137 86 14
## 138 58 42
## 139 17 83
## 140 51 49
## 141 NA NA
## 142 60 40
## 143 NA NA
## 144 80 20
## 145 73 27
## 146 36 64
## 147 84 16
## 148 74 26
## 149 75 25
## 150 13 87
## 151 62 38
## 152 77 23
## 153 49 51
## 154 61 39
## 155 61 39
## 156 99 1
## 157 96 4
## 158 83 17
## 159 NA NA
## 160 58 42
## 161 73 27
## 162 19 81
## 163 28 72
## 164 20 80
## 165 63 37
## 166 82 18
## 167 43 57
## 168 56 44
## 169 56 44
## 170 39 61
## 171 100 0
## 172 55 45
## 173 49 51
## 174 19 81
## 175 38 62
## 176 62 38
## 177 78 22
## 178 14 86
## 179 50 50
## 180 41 59
## 181 70 30
## 182 21 79
## 183 85 15
## 184 74 26
## 185 56 44
## 186 26 74
## 187 27 73
## 188 59 41
## 189 34 66
## 190 44 56
## 191 NA NA
## 192 24 76
## 193 14 86
## 194 68 32
## 195 70 30
## 196 50 50
## 197 51 49
## 198 13 87
## 199 69 31
## 200 84 16
## 201 80 20
## 202 83 17
## 203 NA NA
## 204 93 7
## 205 36 64
## 206 26 74
## 207 94 6
## 208 31 69
## 209 NA NA
## 210 NA NA
## 211 32 68
## 212 36 64
## 213 39 61
## GDP_URBAN_CONTRIBUTION GDP_RURAL_CONTRIBUTION
## 1 114.770 384.230
## 2 1948.916 1728.284
## 3 2996.910 1476.090
## 4 NA NA
## 5 2549.921 1771.979
## 6 13750.100 0.000
## 7 8520.753 641.347
## 8 1939.648 1091.052
## 9 10740.205 12111.295
## 10 50835.821 6283.079
## 11 30707.984 14450.816
## 12 2931.552 2706.048
## 13 18867.744 3593.856
## 14 16183.849 2000.251
## 15 194.416 475.984
## 16 6523.785 7973.515
## 17 4276.500 1425.500
## 18 42500.356 1314.444
## 19 2382.774 2113.026
## 20 311.262 429.838
## 21 92624.700 0.000
## 22 716.520 1330.680
## 23 1325.193 652.707
## 24 2194.073 2283.627
## 25 4589.798 2813.102
## 26 9322.572 1393.028
## 27 24812.176 7835.424
## 28 4582.872 1782.228
## 29 140.319 379.381
## 30 19.426 157.174
## 31 159.440 637.760
## 32 711.894 494.706
## 33 37552.329 8808.571
## 34 2011.280 1232.720
## 35 57047.900 0.000
## 36 175.812 274.988
## 37 203.672 523.728
## 38 NA NA
## 39 10580.053 1307.647
## 40 2089.920 2264.080
## 41 4667.100 1555.700
## 42 206.248 530.352
## 43 1679.013 986.087
## 44 9281.196 2930.904
## 45 5007.470 2696.330
## 46 588.591 565.509
## 47 8015.310 5804.190
## 48 4278.300 1426.100
## 49 20138.653 8225.647
## 50 13940.712 4898.088
## 51 72.216 128.384
## 52 48572.274 7257.926
## 53 974.776 307.824
## 54 4703.936 2316.864
## 55 3636.780 1558.620
## 56 204.769 501.331
## 57 2769.368 1303.232
## 58 1167.628 1486.072
## 59 2226.640 1198.960
## 60 6740.960 10111.440
## 61 94.402 334.698
## 62 9894.780 4240.620
## 63 55.182 269.418
## 64 1843.764 1701.936
## 65 37826.445 6675.255
## 66 34009.474 5536.426
## 67 NA NA
## 68 12581.190 12087.810
## 69 10723.168 1745.632
## 70 341.669 237.431
## 71 1420.559 1259.741
## 72 29494.254 10362.846
## 73 693.264 639.936
## 74 16432.356 10071.444
## 75 29645.868 5646.832
## 76 2971.600 4457.400
## 77 NA NA
## 78 NA NA
## 79 1441.150 1441.150
## 80 153.900 273.600
## 81 161.820 377.580
## 82 868.840 2127.160
## 83 330.858 281.842
## 84 1053.624 972.576
## 85 31823.700 0.000
## 86 8761.120 4122.880
## 87 36921.320 2356.680
## 88 421.920 984.480
## 89 1327.185 1622.115
## 90 3711.241 1515.859
## 91 586.410 302.090
## 92 28656.586 17563.714
## 93 26966.672 2344.928
## 94 23375.199 10501.901
## 95 2547.480 2351.520
## 96 28904.403 14236.497
## 97 3511.787 933.513
## 98 5408.353 3758.347
## 99 184.414 617.386
## 100 646.008 822.192
## 101 44521.792 908.608
## 102 302.890 562.510
## 103 356.184 691.416
## 104 7250.840 3412.160
## 105 8076.819 1206.881
## 106 274.596 706.104
## 107 104.928 113.672
## 108 8830.224 2490.576
## 109 7353.585 3621.915
## 110 89331.090 15764.310
## 111 49990.200 0.000
## 112 130.789 291.111
## 113 71.480 285.920
## 114 6112.144 2260.656
## 115 1920.645 2763.855
## 116 221.556 377.244
## 117 18619.240 979.960
## 118 2209.968 859.432
## 119 NA NA
## 120 475.062 656.038
## 121 3145.086 4343.214
## 122 NA NA
## 123 7098.546 2002.154
## 124 615.986 2062.214
## 125 780.384 845.416
## 126 1415.421 831.279
## 127 3970.978 2538.822
## 128 1690.350 1174.650
## 129 158.925 248.575
## 130 297.908 578.292
## 131 1998.633 3126.067
## 132 6190.100 0.000
## 133 101.593 433.107
## 134 18898.623 1422.477
## 135 38935.051 7974.649
## 136 20132.115 15187.385
## 137 27840.006 4532.094
## 138 656.502 475.398
## 139 60.809 296.891
## 140 632.298 607.502
## 141 NA NA
## 142 302.400 201.600
## 143 NA NA
## 144 67670.960 16917.740
## 145 15177.430 5613.570
## 146 361.152 642.048
## 147 9090.312 1731.488
## 148 1346.430 473.070
## 149 5710.500 1903.500
## 150 185.692 1242.708
## 151 1718.082 1053.018
## 152 4166.239 1244.461
## 153 1048.649 1091.451
## 154 7480.552 4782.648
## 155 13076.936 8360.664
## 156 26196.390 264.610
## 157 69501.984 2895.916
## 158 17473.326 3578.874
## 159 NA NA
## 160 4362.992 3159.408
## 161 7556.522 2794.878
## 162 101.137 431.163
## 163 1869.588 4807.512
## 164 668.660 2674.640
## 165 808.479 474.821
## 166 12985.438 2850.462
## 167 444.061 588.639
## 168 2868.992 2254.208
## 169 6412.336 5038.264
## 170 137.163 214.537
## 171 43783.100 0.000
## 172 8786.800 7189.200
## 173 11323.802 11785.998
## 174 226.765 966.735
## 175 43.624 71.176
## 176 4497.976 2756.824
## 177 23823.384 6719.416
## 178 332.542 2042.758
## 179 3085.850 3085.850
## 180 748.209 1076.691
## 181 4912.600 2105.400
## 182 695.352 2615.848
## 183 41570.270 7335.930
## 184 50971.348 17908.852
## 185 1641.640 1289.860
## 186 212.160 603.840
## 187 139.320 376.680
## 188 2616.355 1818.145
## 189 1568.352 3044.448
## 190 230.824 293.776
## 191 NA NA
## 192 850.344 2692.756
## 193 2128.714 13076.386
## 194 2871.028 1351.072
## 195 7066.570 3028.530
## 196 2293.750 2293.750
## 197 1625.472 1561.728
## 198 66.170 442.830
## 199 2094.150 940.850
## 200 33284.748 6339.952
## 201 29061.440 7265.360
## 202 38633.097 7912.803
## 203 NA NA
## 204 11115.732 836.668
## 205 513.828 913.472
## 206 770.510 2192.990
## 207 12692.538 810.162
## 208 366.637 816.063
## 209 NA NA
## 210 NA NA
## 211 459.904 977.296
## 212 445.608 792.192
## 213 223.509 349.591
## INFANT_DEATH_RATE_PER_THOUSAND
## 1 124.535000
## 2 16.561000
## 3 21.458000
## 4 11.293887
## 5 96.191000
## 6 NA
## 7 12.337000
## 8 24.272000
## 9 14.687000
## 10 4.455000
## 11 3.713000
## 12 37.566000
## 13 14.135000
## 14 6.663000
## 15 41.786000
## 16 12.284000
## 17 6.494000
## 18 3.739000
## 19 16.200000
## 20 76.674000
## 21 NA
## 22 37.995000
## 23 40.684000
## 24 12.695000
## 25 35.117000
## 26 19.016000
## 27 4.529000
## 28 9.149000
## 29 70.958000
## 30 94.083000
## 31 52.835000
## 32 84.915000
## 33 4.926000
## 34 18.458000
## 35 NA
## 36 95.781000
## 37 123.940000
## 38 8.169000
## 39 6.792000
## 40 19.637000
## 41 16.671000
## 42 62.830000
## 43 66.738000
## 44 11.551788
## 45 9.172000
## 46 68.845000
## 47 5.571000
## 48 4.959000
## 49 4.434000
## 50 2.997000
## 51 109.477000
## 52 3.914000
## 53 74.950000
## 54 NA
## 55 21.589000
## 56 56.499000
## 57 19.070000
## 58 22.029000
## 59 19.007000
## 60 93.315000
## 61 47.508000
## 62 4.382000
## 63 62.902000
## 64 17.216000
## 65 2.783000
## 66 3.345000
## 67 12.714000
## 68 7.159000
## 69 43.770000
## 70 66.374000
## 71 25.585000
## 72 3.487000
## 73 43.867000
## 74 4.488000
## 75 NA
## 76 13.042000
## 77 6.725000
## 78 8.070000
## 79 26.269000
## 80 84.176000
## 81 109.818000
## 82 36.830000
## 83 58.260000
## 84 23.515000
## 85 2.026000
## 86 5.304000
## 87 2.057000
## 88 47.894000
## 89 24.929000
## 90 23.385000
## 91 33.293000
## 92 3.859000
## 93 3.347000
## 94 3.417000
## 95 22.023000
## 96 2.549000
## 97 19.140000
## 98 23.716000
## 99 58.142000
## 100 52.000000
## 101 7.563000
## 102 32.765000
## 103 36.809000
## 104 6.700000
## 105 20.223000
## 106 62.103000
## 107 76.853000
## 108 13.248000
## 109 5.941000
## 110 2.289000
## 111 4.130000
## 112 41.030000
## 113 86.060000
## 114 6.880000
## 115 8.070000
## 116 92.206000
## 117 5.405000
## 118 21.000000
## 119 7.158000
## 120 69.930000
## 121 12.112000
## 122 5.884000
## 123 14.146000
## 124 31.447000
## 125 14.344000
## 126 30.705000
## 127 7.733000
## 128 28.502000
## 129 77.858000
## 130 44.802000
## 131 29.761000
## 132 45.800000
## 133 32.013000
## 134 12.281000
## 135 4.168000
## 136 4.680000
## 137 4.757000
## 138 18.315000
## 139 85.820000
## 140 87.561000
## 141 7.800000
## 142 25.053000
## 143 4.859086
## 144 2.940000
## 145 8.414000
## 146 65.724000
## 147 20.075282
## 148 19.503000
## 149 16.168000
## 150 44.474000
## 151 27.375000
## 152 18.273000
## 153 20.886000
## 154 5.546000
## 155 4.175000
## 156 7.243000
## 157 8.195000
## 158 3.647000
## 159 5.884000
## 160 12.216000
## 161 10.534000
## 162 92.870000
## 163 12.260000
## 164 19.848000
## 165 47.486000
## 166 16.202000
## 167 49.802000
## 168 10.630000
## 169 NA
## 170 103.459000
## 171 1.916000
## 172 5.676000
## 173 3.279000
## 174 34.569000
## 175 100.017000
## 176 45.892000
## 177 3.573000
## 178 11.213000
## 179 20.974000
## 180 57.328000
## 181 19.775000
## 182 64.622000
## 183 2.544000
## 184 3.513000
## 185 13.764000
## 186 50.947000
## 187 53.658000
## 188 13.063000
## 189 11.398000
## 190 67.297000
## 191 31.250000
## 192 20.591000
## 193 24.458000
## 194 18.384000
## 195 19.901000
## 196 48.797000
## 197 17.322835
## 198 72.265000
## 199 11.822000
## 200 6.608000
## 201 4.702000
## 202 6.460000
## 203 9.990000
## 204 11.754000
## 205 44.481000
## 206 24.135000
## 207 15.278000
## 208 18.263000
## 209 5.200000
## 210 36.350000
## 211 44.412000
## 212 80.956000
## 213 47.284000
summary.data.frame(UNStatistics)
## SERIAL_NUMBER COUNTRY_NAME COUNTRY_REGION COUNTRY_GROUP
## Min. : 1 Afghanistan : 1 Africa :53 africa: 53
## 1st Qu.: 54 Albania : 1 Asia :50 oecd : 31
## Median :107 Algeria : 1 Europe :39 other :115
## Mean :107 American Samoa: 1 Latin Amer:20 NA's : 14
## 3rd Qu.:160 Angola : 1 Caribbean :17
## Max. :213 Anguilla : 1 (Other) :20
## (Other) :207 NA's :14
## NO_OF_CHILDREN_PER_WOMAN GDP FEMALE_LIFE_EXPECTANCY
## Min. :1.134 Min. : 114.8 Min. :48.11
## 1st Qu.:1.754 1st Qu.: 1283.0 1st Qu.:65.66
## Median :2.262 Median : 4684.5 Median :75.89
## Mean :2.761 Mean : 13012.0 Mean :72.29
## 3rd Qu.:3.545 3rd Qu.: 15520.5 3rd Qu.:79.58
## Max. :6.925 Max. :105095.4 Max. :87.12
## NA's :14 NA's :14 NA's :14
## URBAN_POPULATION_PERCENTAGE RURAL_POPULATION_PERCENTAGE
## Min. : 11.00 Min. : 0.00
## 1st Qu.: 39.00 1st Qu.:25.00
## Median : 59.00 Median :41.00
## Mean : 57.93 Mean :42.07
## 3rd Qu.: 75.00 3rd Qu.:61.00
## Max. :100.00 Max. :89.00
## NA's :14 NA's :14
## GDP_URBAN_CONTRIBUTION GDP_RURAL_CONTRIBUTION
## Min. : 19.43 Min. : 0.0
## 1st Qu.: 587.50 1st Qu.: 605.7
## Median : 2616.36 Median : 1441.2
## Mean :10105.88 Mean : 2906.1
## 3rd Qu.:10927.97 3rd Qu.: 3106.0
## Max. :92624.70 Max. :17908.9
## NA's :14 NA's :14
## INFANT_DEATH_RATE_PER_THOUSAND
## Min. : 1.916
## 1st Qu.: 7.019
## Median : 19.007
## Mean : 29.440
## 3rd Qu.: 44.477
## Max. :124.535
## NA's :6
#3. Graphics: Please make sure to display at least one scatter plot, box plot and histogram. Don't be limited to this. Please explore the many other options in R packages such as ggplot2.
#Comparing all other variables against GDPs for countires falling under 3 categories 'africa, 'oecd' and 'other'
#Scatter plots
install.packages("ggplot2",repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/bhara/OneDrive/Documents/R/win-library/3.5'
## (as 'lib' is unspecified)
## package 'ggplot2' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\Public\Documents\Wondershare\CreatorTemp\RtmpuWAcdI\downloaded_packages
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.5.2
#Compare Urban population against GDP
plot(GDP~URBAN_POPULATION_PERCENTAGE, data = africanCountriesData,las = 1)
abline(lm(GDP~URBAN_POPULATION_PERCENTAGE, data = africanCountriesData))
plot(GDP~URBAN_POPULATION_PERCENTAGE, data = oecdCountriesData,las = 1)
abline(lm(GDP~URBAN_POPULATION_PERCENTAGE, data = oecdCountriesData))
plot(GDP~URBAN_POPULATION_PERCENTAGE, data = otherCountriesData,las = 1)
abline(lm(GDP~URBAN_POPULATION_PERCENTAGE, data = otherCountriesData))
#Compare Female life expectancy against GDP
plot(GDP~FEMALE_LIFE_EXPECTANCY, data = africanCountriesData, las = 1)
abline(lm(GDP~FEMALE_LIFE_EXPECTANCY, data = africanCountriesData))
plot(GDP~FEMALE_LIFE_EXPECTANCY, data = oecdCountriesData, las = 1)
abline(lm(GDP~FEMALE_LIFE_EXPECTANCY, data = oecdCountriesData))
plot(GDP~FEMALE_LIFE_EXPECTANCY, data = otherCountriesData, las = 1)
abline(lm(GDP~FEMALE_LIFE_EXPECTANCY, data = otherCountriesData))
#Compare Number Of Children per woman against GDP
plot(GDP~NO_OF_CHILDREN_PER_WOMAN, data = africanCountriesData, las = 1)
abline(lm(GDP~NO_OF_CHILDREN_PER_WOMAN, data = africanCountriesData))
plot(GDP~NO_OF_CHILDREN_PER_WOMAN, data = oecdCountriesData, las = 1)
abline(lm(GDP~NO_OF_CHILDREN_PER_WOMAN, data = oecdCountriesData))
plot(GDP~NO_OF_CHILDREN_PER_WOMAN, data = otherCountriesData, las = 1)
abline(lm(GDP~NO_OF_CHILDREN_PER_WOMAN, data = otherCountriesData))
#Compare Infant deaht rate per thousand against GDP
plot(GDP~INFANT_DEATH_RATE_PER_THOUSAND, data = africanCountriesData, las = 1)
abline(lm(GDP~INFANT_DEATH_RATE_PER_THOUSAND, data = africanCountriesData))
plot(GDP~INFANT_DEATH_RATE_PER_THOUSAND, data = oecdCountriesData, las = 1)
abline(lm(GDP~INFANT_DEATH_RATE_PER_THOUSAND, data = oecdCountriesData))
plot(GDP~INFANT_DEATH_RATE_PER_THOUSAND, data = otherCountriesData, las = 1)
abline(lm(GDP~INFANT_DEATH_RATE_PER_THOUSAND, data = otherCountriesData))
#Histograms For GDP of the countries categorized under 3 groups 'africa', 'oecd' and 'other'
ggplot(africanCountriesData, aes(x = GDP)) +
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
ggplot(oecdCountriesData, aes(x = GDP)) +
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
ggplot(otherCountriesData, aes(x = GDP)) +
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
ggplot(UNStatistics,aes(x=GDP)) +
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 14 rows containing non-finite values (stat_bin).
#Box Plots
boxplot(GDP~COUNTRY_NAME,data=UNStatistics, main="UN Statistics For Nations",
xlab="GDP", ylab="Country Name")
boxplot(africanCountriesData$GDP_RURAL_CONTRIBUTION)
boxplot(oecdCountriesData$GDP_RURAL_CONTRIBUTION)
boxplot(otherCountriesData$GDP_RURAL_CONTRIBUTION)
boxplot(africanCountriesData$GDP_URBAN_CONTRIBUTION)
boxplot(oecdCountriesData$GDP_RURAL_CONTRIBUTION)
boxplot(otherCountriesData$GDP_RURAL_CONTRIBUTION)
#Density Plots
plot(density(africanCountriesData$GDP),main = "GDP Density Plot For African Countries",col="gold")
polygon(density(africanCountriesData$GDP),main = "GDP Density Plot For African Countries",col="blue",border = "red")
plot(density(oecdCountriesData$GDP),main = "GDP Density Plot For OECD Countries",col="gold")
polygon(density(oecdCountriesData$GDP),main = "GDP Density Plot For OECD Countries",col="gold",border = "red")
plot(density(otherCountriesData$GDP),main = "GDP Density Plot For Other Countries",col="gold")
polygon(density(otherCountriesData$GDP),main = "GDP Density Plot For Other Countries",col="purple",border = "red")
#Violin Plots
install.packages("vioplot",repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/bhara/OneDrive/Documents/R/win-library/3.5'
## (as 'lib' is unspecified)
## package 'vioplot' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\Public\Documents\Wondershare\CreatorTemp\RtmpuWAcdI\downloaded_packages
library(vioplot)
## Warning: package 'vioplot' was built under R version 3.5.2
## Loading required package: sm
## Warning: package 'sm' was built under R version 3.5.2
## Package 'sm', version 2.2-5.6: type help(sm) for summary information
GDP_Africa <- africanCountriesData$GDP
GDP_OECD <- oecdCountriesData$GDP
GDP_Other <- otherCountriesData$GDP
vioplot(GDP_Africa, GDP_OECD,GDP_Other, names=c("Africa", "OECD", "Other"),
col="blue")
title("GDP Comparision")
FLP_Africa <- africanCountriesData$FEMALE_LIFE_EXPECTANCY
FLP_OECD <- oecdCountriesData$FEMALE_LIFE_EXPECTANCY
FLP_Other <- otherCountriesData$FEMALE_LIFE_EXPECTANCY
vioplot(FLP_Africa, FLP_OECD,FLP_Other, names=c("Africa", "OECD", "Other"),
col="gold")
title("FEMALE_LIFE_EXPECTANCY Comparision")
#Bag Plots - 2D extensions of Box Plots
install.packages("aplpack",repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/bhara/OneDrive/Documents/R/win-library/3.5'
## (as 'lib' is unspecified)
## package 'aplpack' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\Public\Documents\Wondershare\CreatorTemp\RtmpuWAcdI\downloaded_packages
library(aplpack)
## Warning: package 'aplpack' was built under R version 3.5.2
## Loading required package: tcltk
attach(africanCountriesData)
bagplot(GDP,RURAL_POPULATION_PERCENTAGE, xlab="GDP", ylab="% Rural Population",
main="GDP Impact By Rural Population")
#Comparing GDP's for the countries categorized as one of the 3 Groups 'africa', 'oecd' and 'other'
gdpDataFrame <- data.frame(africanCountriesData$GDP[c(1:nrow(oecdCountriesData))],oecdCountriesData$GDP,otherCountriesData$GDP[c(1:nrow(oecdCountriesData))])
colnames(gdpDataFrame) <- c("GDP_AFRICAN_NATIONS","GDP_OECD_NATIONS","GDP_OTHER_NATIONS")
ggplot(gdpDataFrame, aes(c(1:nrow(gdpDataFrame)), y = value, color = variable)) +
geom_point(aes(y = GDP_AFRICAN_NATIONS, col = "GDP_AFRICAN_NATIONS")) +
geom_point(aes(y = GDP_OECD_NATIONS, col = "GDP_OECD_NATIONS")) + geom_point(aes(y = GDP_OTHER_NATIONS, col = "GDP_OTHER_NATIONS"))
#4. Meaningful question for analysis: Please state at the beginning a meaningful question for analysis. Use the first three steps and anything else that would be helpful to answer the question you are posing from the data set you chose. Please write a brief conclusion paragraph in R markdown at the end.
Question For Analysis :
Is GDP (Quality OF Living) is dependent on other variables in the observation, such as ‘Urban Population Percentage’ ?
It is clearly observed from above graphs, summary details, that the major contribution of GDP is by urban population. The slope of the linear regression line for the scatter plots are also positive, indicating more the people staying in urban areas, more will be the GDP for the country and the quality of life.
It can also be observed, higher the urban population and GDP, lesser is the probability for infant mortality, lesser will be the children per woman and higher will be the expectancy of females living in the country. We can observe these from the scatter plots and their slopes, which are all negative, indicating, higher the GDP value, lesser will be these values.
Quality of life is dependent on the level of urbanization in the country, which also impacts other variables in the observation.
Also sampling out the observations, with respect to different groups such as ‘africa’, ‘oecd’ and ‘other’, this behavior is observed in all respects. We have also captured different plots for each one of them above.
#5. BONUS - place the original .csv in a github file and have R read from the link. This will be a very useful skill as you progress in your data science education and career.
# This project uses the checked data set in github, this is the url for the dataset, from which this R program reads it - https://raw.githubusercontent.com/samsri01/Repo-For-CSV-File-Storage/master/UN_Statistics.csv