Our Required Library
library(ggplot2)
#install.packages("gapminder")
library(gapminder)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(gapminder)
We will try to visulize some graphical represantation variable in Gapminder Dataset. Now, We will see the first 6 row to generate some pre-knowledge about gapminder datatset.
head(gapminder)
## # A tibble: 6 x 6
## country continent year lifeExp pop gdpPercap
## <fct> <fct> <int> <dbl> <int> <dbl>
## 1 Afghanistan Asia 1952 28.8 8425333 779.
## 2 Afghanistan Asia 1957 30.3 9240934 821.
## 3 Afghanistan Asia 1962 32.0 10267083 853.
## 4 Afghanistan Asia 1967 34.0 11537966 836.
## 5 Afghanistan Asia 1972 36.1 13079460 740.
## 6 Afghanistan Asia 1977 38.4 14880372 786.
Continent wise scatterplot between lifeExptation and Population
Con_exp<-gapminder %>%
ggplot(aes(pop,lifeExp,col=continent))+geom_point()
ggplotly(Con_exp)
Continent wise scatterplot between lifeExptation and Population
Country_exp<-gapminder %>%
ggplot(aes(pop,lifeExp,col=country))+geom_point()+labs(title = "lifeExptation vs Population")
ggplotly(Country_exp)
Year wise scatterplot between lifeExptation and Population
year_exp<-gapminder %>%
ggplot(aes(pop,lifeExp,col=country))+geom_point()+labs(title = "lifeExptation vs Population")+facet_wrap(~year)
ggplotly(year_exp)
COntinent-wise scatterplot between Year and LifeExpectancy
year_exp<-gapminder %>%
ggplot(aes(year,lifeExp,col=country))+geom_point()+labs(title = "lifeExptation vs Population")+facet_wrap(~continent)
ggplotly(year_exp)