You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
knitr::kable(df_broadband_penetration %>%
select(everything()) %>%
summarise_all(list(~sum(is.na(.)))),
caption='Number of NULL values in each column')
knitr::kable(df_share_indviduals_using_internet %>%
select(everything()) %>%
summarise_all(list(~sum(is.na(.)))),
caption='Number of NULL values in each column')
Number of NULL values in each column
Entity
Code
Year
Individuals.using.the.Internet….of.population.
0
0
0
0
str(df_continents)
## 'data.frame': 249 obs. of 11 variables:
## $ ï..name : chr "Afghanistan" "Ã…land Islands" "Albania" "Algeria" ...
## $ alpha.2 : chr "AF" "AX" "AL" "DZ" ...
## $ alpha.3 : chr "AFG" "ALA" "ALB" "DZA" ...
## $ country.code : int 4 248 8 12 16 20 24 660 10 28 ...
## $ iso_3166.2 : chr "ISO 3166-2:AF" "ISO 3166-2:AX" "ISO 3166-2:AL" "ISO 3166-2:DZ" ...
## $ region : chr "Asia" "Europe" "Europe" "Africa" ...
## $ sub.region : chr "Southern Asia" "Northern Europe" "Southern Europe" "Northern Africa" ...
## $ intermediate.region : chr "" "" "" "" ...
## $ region.code : int 142 150 150 2 9 150 2 19 NA 19 ...
## $ sub.region.code : int 34 154 39 15 61 39 202 419 NA 419 ...
## $ intermediate.region.code: int NA NA NA NA NA NA 17 29 NA 29 ...
knitr::kable(df_continents %>%
select(everything()) %>%
summarise_all(list(~sum(is.na(.)))),
caption='Number of NULL values in each column')
knitr::kable(df_mobile_subscription %>%
filter(Code!="") %>%
filter(Year==2019) %>%
select(Country, Code, Mobile_Cellular_Subscription_Per_100_People)%>%
arrange(desc(Mobile_Cellular_Subscription_Per_100_People)) %>% top_n(5),
caption="Countries With Maximum Mobile Subscription in 2019")
## Selecting by Mobile_Cellular_Subscription_Per_100_People
Countries With Maximum Mobile Subscription in 2019
Country
Code
Mobile\_Cellular\_Subscription\_Per\_100\_People
Hong Kong
HKG
288.5327
United Arab Emirates
ARE
200.6321
Seychelles
SYC
198.1522
Thailand
THA
186.1586
Montenegro
MNE
183.2837
knitr::kable(df_broadband_penetration %>%
filter(Code!="") %>%
filter(Year==2019) %>%
select(Country, Code, Fixed_Broadband_Subscription_Per_100_People)%>%
arrange(desc(Fixed_Broadband_Subscription_Per_100_People)) %>% top_n(5),
caption="Countries With Maximum Fixed Broadband Subscription in 2019")
## Selecting by Fixed_Broadband_Subscription_Per_100_People
Countries With Maximum Fixed Broadband Subscription in 2019
Country
Code
Fixed\_Broadband\_Subscription\_Per\_100\_People
Gibraltar
GIB
57.85288
Monaco
MCO
52.55107
Andorra
AND
47.13126
Switzerland
CHE
46.90110
Malta
MLT
45.98680
knitr::kable(df_internet_users %>%
filter(Code!="") %>%
filter(Year==2016) %>%
select(Country, Code, Number_Of_Internet_Users)%>%
arrange(desc(Number_Of_Internet_Users)) %>% top_n(5),
caption="Countries With Maximum Internet users in 2016")
## Selecting by Number_Of_Internet_Users
Countries With Maximum Internet users in 2016
Country
Code
Number\_Of\_Internet\_Users
World
OWID\_WRL
3419398061
China
CHN
746662194
India
IND
391255067
United States
USA
245425910
Brazil
BRA
126403573
knitr::kable(head(df_political_indexes %>%
filter(Year=="2006") %>%
select(Country, Democracy_Index) %>%
arrange(desc(Democracy_Index)), 5),
caption="Countries With Maximum Democracy Indexes in 2006")
Countries With Maximum Democracy Indexes in 2006
Country
Democracy\_Index
Sweden
9.88
Iceland
9.71
Netherlands
9.66
Norway
9.55
Denmark
9.52
knitr::kable(head(df_political_indexes %>%
filter(Year=="2006") %>%
select(Country, Democracy_Index) %>%
arrange(Democracy_Index), 5),
caption="Countries With Minimum Democracy Indexes in 2006")
Countries With Minimum Democracy Indexes in 2006
Country
Democracy\_Index
North Korea
1.03
Central African Republic
1.61
Chad
1.65
Togo
1.75
Myanmar
1.77
knitr::kable(head(df_political_indexes %>%
filter(Year=="2020") %>%
select(Country, Democracy_Index) %>%
arrange(desc(Democracy_Index)), 5),
caption="Countries With Maximum Democracy Indexes in 2020")
Countries With Maximum Democracy Indexes in 2020
Country
Democracy\_Index
Norway
9.81
Iceland
9.37
Sweden
9.26
New Zealand
9.25
Canada
9.24
knitr::kable(head(df_political_indexes %>%
filter(Year=="2020") %>%
select(Country, Democracy_Index) %>%
arrange(Democracy_Index), 5),
caption="Countries With Minimum Democracy Indexes in 2020")
Countries With Minimum Democracy Indexes in 2020
Country
Democracy\_Index
North Korea
1.08
Congo, Dem. Rep.
1.13
Central African Republic
1.32
Syria
1.43
Chad
1.55
options(repr.plot.width=12, repr.plot.height=8)
#Comparing the growth of Mobile Subscriptions from 2009 to 2019#Removing the regions from the Country column to obtain only the countriesdf_mobile_subscription_onlycountries<-df_mobile_subscription %>% filter(Code!="")
#The records for the year 2009df_mobile_subscription_onlycountries_2009<-df_mobile_subscription_onlycountries %>% filter(Year==2009)
#The records for the year 2019df_mobile_subscription_onlycountries_2019<-df_mobile_subscription_onlycountries %>% filter(Year==2019)
#Joining the tables to get the records for only 2009 and 2019df_mobile_subscription_combined_2009_2019<- inner_join(df_mobile_subscription_onlycountries_2009,
df_mobile_subscription_onlycountries_2019,
by= c("Country", "Code"))
df_mobile_subscription_combined_change<- mutate(df_mobile_subscription_combined_2009_2019,
Percentage_Change= ((Mobile_Cellular_Subscription_Per_100_People.y-Mobile_Cellular_Subscription_Per_100_People.x)))
#Figuring out the countries which have improved the most in a decadedf_mobile_subscription_combined_change_ordered<-df_mobile_subscription_combined_change %>%
arrange(desc(df_mobile_subscription_combined_change$Percentage_Change))
#Obtaining the top 10 countries to have improved the mostdf_mobile_subscription_combined_change_ordered_top10<-df_mobile_subscription_combined_change_ordered %>% head(20)
# renaming the columns
colnames(df_mobile_subscription_combined_change_ordered_top10)[4] <-"Mobile_Cellular_Subscription_Per_100_People_2009"
colnames(df_mobile_subscription_combined_change_ordered_top10)[6] <-"Mobile_Cellular_Subscription_Per_100_People_2019"# pivoting the 2009 and 2019 columns df_mobile_subscription_for_plot<- pivot_longer(df_mobile_subscription_combined_change_ordered_top10,
cols=c("Mobile_Cellular_Subscription_Per_100_People_2019",
"Mobile_Cellular_Subscription_Per_100_People_2009"),
names_to="Mobile_cellular_Subscriptions_per_100_people",
values_to="Subscriptions_per_100_people")
# bar plot to visualize the top-10 countries
ggplot(df_mobile_subscription_for_plot,
aes(fill=Mobile_cellular_Subscriptions_per_100_people,
x=Country,
y=Subscriptions_per_100_people,
group=Mobile_cellular_Subscriptions_per_100_people)) +
geom_bar(position="dodge",
stat="identity") +
ggtitle("Countries with Highest Change of Mobile subscriptions per 100 people") +
theme(legend.box.background= element_rect(color="black",
size=0.5),
legend.box.margin= margin(25, 6, 6, 6)) +
theme(axis.text.x= element_text(size=10,
angle=90,
hjust=0.95,
vjust=0.2))
# figuring out the countries which have improved the lowestdf_mobile_subscription_combined_change_ordered_asc<-df_mobile_subscription_combined_change %>%
arrange(df_mobile_subscription_combined_change$Percentage_Change)
df_mobile_subscription_combined_change_ordered_bottom10<-df_mobile_subscription_combined_change_ordered_asc %>% head(20)
colnames(df_mobile_subscription_combined_change_ordered_bottom10)[4] <-"Mobile_Cellular_Subscription_Per_100_People_2009"
colnames(df_mobile_subscription_combined_change_ordered_bottom10)[6] <-"Mobile_Cellular_Subscription_Per_100_People_2019"df_mobile_subscription_for_plot_bottom10<- pivot_longer(df_mobile_subscription_combined_change_ordered_bottom10,
cols= c("Mobile_Cellular_Subscription_Per_100_People_2019",
"Mobile_Cellular_Subscription_Per_100_People_2009"),
names_to="Mobile_cellular_Subscriptions_per_100_people",
values_to="Subscriptions_per_100_people")
# plotting a stacked Bar-Plot to visualize the bottom 10 countries
ggplot(df_mobile_subscription_for_plot_bottom10,
aes(fill=Mobile_cellular_Subscriptions_per_100_people,
x=Subscriptions_per_100_people,
y=Country,
group=Mobile_cellular_Subscriptions_per_100_people)) +
geom_bar(position="stack",
stat="identity") +
ggtitle("Countries with Lowest Mobile subscriptions per 100 people") +
theme(legend.box.background= element_rect(color="black",
size=0.5),
legend.box.margin= margin(25, 6, 6, 6))
# comparing the growth of broadband from 2009 to 2019# removing the regions from the Entity column to obtain only the countriesdf_broadband_penetration_onlycountries<-df_broadband_penetration %>% filter(Code!="")
# the records for the year 2009df_broadband_penetration_onlycountries_2009<-df_broadband_penetration_onlycountries %>% filter(Year==2009)
# the records for the year 2019df_broadband_penetration_onlycountries_2019<-df_broadband_penetration_onlycountries %>% filter(Year==2019)
# joining the tables to get the records for only 2009 and 2019df_broadband_penetration_combined_2009_2019<- inner_join(df_broadband_penetration_onlycountries_2009,
df_broadband_penetration_onlycountries_2019,
by= c("Country", "Code"))
df_broadband_penetration_combined_change<- mutate(df_broadband_penetration_combined_2009_2019,
Percentage_Change= ((Fixed_Broadband_Subscription_Per_100_People.y-Fixed_Broadband_Subscription_Per_100_People.x)))
# figuring out the countries which have improved the most in a decadedf_broadband_penetration_combined_change_ordered<-df_broadband_penetration_combined_change %>%
arrange(desc(df_broadband_penetration_combined_change$Percentage_Change))
# obtaining the top 10 countries to have improved the mostdf_broadband_penetration_combined_change_ordered_top10<-df_broadband_penetration_combined_change_ordered %>% head(20)
# renaming the columns
colnames(df_broadband_penetration_combined_change_ordered_top10)[4] <-"Fixed_Broadband_Subscription_Per_100_People_2009"
colnames(df_broadband_penetration_combined_change_ordered_top10)[6] <-"Fixed_Broadband_Subscription_Per_100_People_2019"# pivoting the 2009 and 2019 columns df_broadband_penetration_for_plot<- pivot_longer(df_broadband_penetration_combined_change_ordered_top10,
cols= c("Fixed_Broadband_Subscription_Per_100_People_2019",
"Fixed_Broadband_Subscription_Per_100_People_2009"),
names_to="Fixed_Broadband_Subscriptions_per_100_people",
values_to="Subscriptions_per_100_people")
# bar plot to visualize the top-10 countries
ggplot(df_broadband_penetration_for_plot,
aes(fill=Fixed_Broadband_Subscriptions_per_100_people,
x=Country,
y=Subscriptions_per_100_people,
group=Fixed_Broadband_Subscriptions_per_100_people)) +
geom_bar(position="dodge",
stat="identity") +
ggtitle("Countries with Highest Change of Broadband subscriptions per 100 people") +
theme(legend.box.background= element_rect(color="black",
size=0.5),
legend.box.margin= margin(25, 6, 6, 6)) +
theme(axis.text.x= element_text(size=10,
angle=90,
hjust=0.95,
vjust=0.2))
# figuring out the countries which have improved the lowestdf_broadband_penetration_combined_change_ordered_asc<-df_broadband_penetration_combined_change %>%
arrange(df_broadband_penetration_combined_change$Percentage_Change)
df_broadband_penetration_combined_change_ordered_bottom10<-df_broadband_penetration_combined_change_ordered_asc %>% head(20)
colnames(df_broadband_penetration_combined_change_ordered_bottom10)[4] <-"Fixed_Broadband_Subscription_Per_100_People_2009"
colnames(df_broadband_penetration_combined_change_ordered_bottom10)[6] <-"Fixed_Broadband_Subscription_Per_100_People_2019"df_broadband_penetration_for_plot_bottom10<- pivot_longer(df_broadband_penetration_combined_change_ordered_bottom10,
cols= c("Fixed_Broadband_Subscription_Per_100_People_2019",
"Fixed_Broadband_Subscription_Per_100_People_2009"),
names_to="Fixed_Broadband_Subscriptions_per_100_people",
values_to="Subscriptions_per_100_people")
# plotting a stacked Bar-Plot to visualize the bottom 10 countries
ggplot(df_broadband_penetration_for_plot_bottom10,
aes(fill=Fixed_Broadband_Subscriptions_per_100_people,
x=Subscriptions_per_100_people,
y=Country,
group=Fixed_Broadband_Subscriptions_per_100_people))+
geom_bar(position="stack",
stat="identity") +
ggtitle("Countries with Lowest Broadband subscriptions per 100 people") +
theme(legend.box.background= element_rect(color="black",
size=0.5),
legend.box.margin= margin(25, 6, 6, 6))
options(repr.plot.width=25, repr.plot.height=5)
# heatmap of df_mobile_subscription for 2009# importing the world mapworld_map<- map_data("world")
# merging the world map with the mobile subscriptions by country datasetworld_map= merge(world_map,
df_mobile_subscription_onlycountries_2009,
by.x="region",
by.y="Country")
# arranging the table on the basis of Mobile subscriptions per 100 peopledf_mobile_subscription_onlycountries_top10<-df_mobile_subscription_onlycountries %>% arrange(desc(Mobile_Cellular_Subscription_Per_100_People)) %>% head(10)
# plotting the heatmap of the world for the year 2009
ggplot(world_map, aes(map_id=region,
fill=Mobile_Cellular_Subscription_Per_100_People)) +
geom_map(map=world_map,
size=0.1) +
scale_fill_gradient(low="#fff7bc",
high="#cc4c02",
name="Mobile Cellular Subscriptions Per 100 People") +
expand_limits(x=world_map$long,
y=world_map$lat) +
ggtitle("Mobile Cellular Subscriptions Per 100 People Throughout The World - 2009") +
theme(legend.box.background= element_rect(color="black",
size=0.5),
legend.box.margin= margin(25, 6, 6, 6))
# heatmap of df_mobile_subscription for 2019world_map<- map_data("world")
world_map= merge(world_map,
df_mobile_subscription_onlycountries_2019,
by.x="region",
by.y="Country")
df_mobile_subscription_onlycountries_top10<-df_mobile_subscription_onlycountries %>%
arrange(desc(Mobile_Cellular_Subscription_Per_100_People)) %>%
head(10)
# plotting the heatmap of the world for the year 2019
ggplot(world_map,
aes(map_id=region,
fill=Mobile_Cellular_Subscription_Per_100_People)) +
geom_map(map=world_map,
size=0.25) +
scale_fill_gradient(low="#fff7bc",
high="#cc4c02",
name="Mobile Cellular Subscriptions Per 100 People") +
expand_limits(x=world_map$long,
y=world_map$lat) +
ggtitle("Mobile Cellular Subscriptions Per 100 People Throughout The World - 2019") +
theme(legend.box.background= element_rect(color="black",
size=0.5),
legend.box.margin= margin(25, 6, 6, 6))
knitr::opts_chunk$set(warning=FALSE, message=FALSE)
# heatmap of df_broadband_penetration for 2009# importing the world mapworld_map<- map_data("world")
# merging the world map with the broadband penetration by country datasetworld_map= merge(world_map,df_broadband_penetration_onlycountries_2009,
by.x="region",
by.y="Country")
# arranging the table on the basis of Fixed Broadband subscriptions per 100 peopledf_broadband_penetration_onlycountries_top10<-df_broadband_penetration_onlycountries %>%
arrange(desc(Fixed_Broadband_Subscription_Per_100_People)) %>% head(10)
# plotting the heatmap of the world for the year 2009
ggplot(world_map,
aes(map_id=region,
fill=Fixed_Broadband_Subscription_Per_100_People)) +
geom_map(map=world_map,
size=0.1) +
scale_fill_gradient(low="#fff7bc",
high="#cc4c02",
name="Fixed Broadband Subscriptions Per 100 People") +
expand_limits(x=world_map$long,
y=world_map$lat) +
ggtitle("Broadband Subscriptions Per 100 People Throughout the World – 2009") +
theme(legend.box.background= element_rect(color="black",
size=0.5),
legend.box.margin= margin(25, 6, 6, 6))
# heatmap of df_broadband_penetration for 2019world_map<- map_data("world")
world_map= merge(world_map,df_broadband_penetration_onlycountries_2019,
by.x="region",
by.y="Country")
df_broadband_penetration_onlycountries_top10<-df_broadband_penetration_onlycountries %>%
arrange(desc(Fixed_Broadband_Subscription_Per_100_People)) %>% head(10)
# plotting the heatmap of the world for the year 2019
ggplot(world_map,
aes(map_id=region,
fill=Fixed_Broadband_Subscription_Per_100_People)) +
geom_map(map=world_map,
size=0.1) +
scale_fill_gradient(low="#fff7bc",
high="#cc4c02",
name="Fixed Broadband Subscriptions Per 100 People") +
expand_limits(x=world_map$long,
y=world_map$lat) +
ggtitle("Broadband Subscriptions Per 100 People Throughout the World – 2019") +
theme(legend.box.background= element_rect(color="black",
size=0.5),
legend.box.margin= margin(6, 6, 6, 6))
options(repr.plot.width=12, repr.plot.height=8)
# filtering the Broadband Penetration Dataset for the year 2019df_broadband_penetration_2019<-df_broadband_penetration %>% filter(Year==2019)
#Filtering the Mobile Cellular Dataset for the year 2019df_mobile_subscription_2019<-df_mobile_subscription %>% filter(Code!="") %>% filter(Year==2019)
# df_broadband_penetration and Continents# joining the Broadband Penetration and Continents dataset using Country as the primary Keydf_broadband_penetration_continents<- inner_join(df_broadband_penetration_2019,
df_continents,
by="Country")
# grouping the dataset on the basis of regiondf_broadband_penetration_continents_grouped<-df_broadband_penetration_continents %>%
group_by(Region) %>%
summarise(Mean_Broadband_Subscriptions_Per_100_people=
mean(Fixed_Broadband_Subscription_Per_100_People))
head(df_broadband_penetration_continents_grouped)
## # A tibble: 5 x 2
## Region Mean_Broadband_Subscriptions_Per_100_people
## <chr> <dbl>
## 1 Africa 2.81
## 2 Americas 16.3
## 3 Asia 13.8
## 4 Europe 34.4
## 5 Oceania 8.23
# plotting the Pie-Chart for df_broadband_penetration for different regions
ggplot(df_broadband_penetration_continents_grouped,
aes(x="",
y=Mean_Broadband_Subscriptions_Per_100_people,
fill=Region)) +
geom_bar(stat="identity",
width=1) +
coord_polar("y",
start=0) +
theme_void() +
ggtitle("Mean Broadband Subscriptions Per 100 People \nAcross different Regions of the World") +
theme(plot.title= element_text(hjust=0.3,
size=15,
face="bold")) +
guides(fill= guide_legend(reverse=TRUE)) +
scale_fill_brewer(name="Regions") +
theme(legend.text= element_text(size=10),
legend.title= element_text(hjust=0.5,
size=10,
face="bold")) +
geom_text(aes(label= paste0(round(df_broadband_penetration_continents_grouped$Mean_Broadband_Subscriptions_Per_100_people,
digits=2))),
position= position_stack(vjust=0.5),
size=3,
face="bold") +
theme(legend.box.background= element_rect(color="black",
size=1),
legend.box.margin= margin(25, 6, 6, 6))
# df_mobile_subscription and Democracy of Countriesdf_mobile_subscription_continents<- inner_join(df_mobile_subscription_2019,df_continents,by="Country")
df_mobile_subscription_continents_grouped<-df_mobile_subscription_continents %>%
group_by(Region) %>%
summarise(Mean_cellular_Subscriptions_Per_100_people=
mean(Mobile_Cellular_Subscription_Per_100_People))
head(df_mobile_subscription_continents_grouped)
## # A tibble: 5 x 2
## Region Mean_cellular_Subscriptions_Per_100_people
## <chr> <dbl>
## 1 Africa 92.8
## 2 Americas 106.
## 3 Asia 128.
## 4 Europe 122.
## 5 Oceania 75.3
# plotting the Pie-Chart for df_mobile_subscription for different regions
ggplot(df_mobile_subscription_continents_grouped,
aes(x="",
y=Mean_cellular_Subscriptions_Per_100_people,
fill=Region)) +
geom_bar(stat="identity",
width=1) +
coord_polar("y",
start=0) +
theme_void() +
ggtitle("Mean Cellular Subscriptions Per 100 People \nAcross different Regions of the World") +
theme(plot.title= element_text(hjust=0.3,
size=15,
face="bold")) +
guides(fill= guide_legend(reverse=TRUE))+
scale_fill_brewer(name="Regions") +
theme(legend.text= element_text(size=10),
legend.title= element_text(hjust=0.5,
size=10,
face="bold")) +
geom_text(aes(label= paste0(round(df_mobile_subscription_continents_grouped$Mean_cellular_Subscriptions_Per_100_people,
digits=2))),
position= position_stack(vjust=0.5),
size=3,
face="bold") +
theme(legend.box.background= element_rect(color="black", size=1),
legend.box.margin= margin(25, 6, 6, 6))