#imports
library('plotly')
#data
countries <- [Link]('C:/Users/hp/Documents/[Link]',header=TRUE)
#question 1 avarage life expectancy Asia
Asia<- countries %>% filter(continent=="Asia")
lifeEXp <- Asia %>% group_by(country,iso_alpha)%>% summarise(meanLifeEXp=mean(lifeExp),.groups =
'drop')
fig <- plot_ly(lifeEXp,
type='choropleth',
locations=lifeEXp$iso_alpha,
z=lifeEXp$meanLifeEXp,
text=lifeEXp$country)%>%
layout(title = "Mean Life Expectancy in Asian Countries")
fig
#question 2 deviation of gdp in European countries
Europe<- countries %>% filter(continent=="Europe")
SAmerica <- countries %>% filter(country=='Paraguay'|country== 'Brazil' | country=='Uruguay'
| country=='Argentina' | country=='Bolivia'| country=='Chile' |
country=='Colombia' | country=='Venezuela'| country=='Peru' |
country=='Ecuador')
EuroAmerica <- rbind(SAmerica,Europe)
fig <- plot_ly(EuroAmerica,
type='choropleth',
locations=EuroAmerica$iso_alpha,
z=EuroAmerica$gdpPercap,
text=EuroAmerica$country,
frame = EuroAmerica$year)%>%
layout(title="Deviation of GDPin Europe and South American countries")
fig
#question 3 change of population in african countries last three decades
Africa<- countries %>% filter(continent=="Africa")
fig <- plot_ly(Africa,
type='choropleth',
locations=Africa$iso_alpha,
z=Africa$pop,
text=Africa$country,
frame = Africa$year)%>%
layout(title="Deviation of population in Africa in the last 3 decades")
fig