State Crude_Birth_Rate_Total Crude_Birth_Rate_Rural
1 Andhra Pradesh 17.9 18.3
2 Arunachal Pradesh 20.5 22.1
3 Assam 23.2 24.4
4 Bihar 28.1 28.8
5 Chhattisgarh 25.3 26.8
6 Goa 13.2 12.6
Crude_Birth_Rate_Urban Crude_Death_Rate_Total Crude_Death_Rate_Rural
1 16.7 7.6 8.6
2 14.6 5.9 6.9
3 15.8 8.2 8.6
4 22.0 6.8 7.0
5 18.6 8.0 8.4
6 13.7 6.6 8.1
Crude_Death_Rate_Urban
1 5.4
2 2.3
3 5.8
4 5.6
5 6.2
6 5.7
'data.frame': 36 obs. of 7 variables:
$ State : chr "Andhra Pradesh" "Arunachal Pradesh" "Assam" "Bihar" ...
$ Crude_Birth_Rate_Total: num 17.9 20.5 23.2 28.1 25.3 13.2 21.8 22.3 16.9 18.3 ...
$ Crude_Birth_Rate_Rural: num 18.3 22.1 24.4 28.8 26.8 12.6 23.3 23.3 17.5 19.5 ...
$ Crude_Birth_Rate_Urban: num 16.7 14.6 15.8 22 18.6 13.7 19.4 19.8 11.5 13.5 ...
$ Crude_Death_Rate_Total: num 7.6 5.9 8.2 6.8 8 6.6 6.7 6.6 6.9 5.7 ...
$ Crude_Death_Rate_Rural: num 8.6 6.9 8.6 7 8.4 8.1 7.5 7 7.2 5.9 ...
$ Crude_Death_Rate_Urban: num 5.4 2.3 5.8 5.6 6.2 5.7 5.5 5.6 4.2 4.7 ...
State Crude_Birth_Rate_Total Crude_Birth_Rate_Rural
Length:36 Min. :13.20 Min. :12.60
Class :character 1st Qu.:16.68 1st Qu.:17.15
Mode :character Median :18.10 Median :19.95
Mean :19.69 Mean :20.74
3rd Qu.:22.52 3rd Qu.:23.88
Max. :28.30 Max. :29.20
Crude_Birth_Rate_Urban Crude_Death_Rate_Total Crude_Death_Rate_Rural
Min. :11.50 Min. :3.600 Min. :3.700
1st Qu.:14.80 1st Qu.:5.450 1st Qu.:5.775
Median :16.05 Median :6.650 Median :7.050
Mean :16.82 Mean :6.361 Mean :6.803
3rd Qu.:18.38 3rd Qu.:7.250 3rd Qu.:8.125
Max. :28.60 Max. :8.600 Max. :9.000
Crude_Death_Rate_Urban
Min. :2.300
1st Qu.:4.175
Median :5.550
Mean :5.217
3rd Qu.:6.000
Max. :7.000
### Histogram with breaks and density for Crude Death Rate-Urban
---
title: "EDA"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: scroll
theme: flatly
social: menu
source_code: embed
navbar:
- { title: "Dataset Description", href: "#dataset-description" }
- { title: "Univariate Analysis", href: "#univariate-analysis" }
- { title: "Bivariate Analysis", href: "#bivariate-analysis" }
- { title: "Multivariate Analysis", href: "#multivariate-analysis" }
---
## Dataset Description {.tabset .active} {#dataset-description}
### View of Dataset
```{r}
library(ggplot2)
library(dplyr)
library(reshape2)
library(viridis)
data <- read.csv("RHS_2011_Table_4_0.csv")
colnames(data) <- c("State", "Crude_Birth_Rate_Total", "Crude_Birth_Rate_Rural",
"Crude_Birth_Rate_Urban", "Crude_Death_Rate_Total",
"Crude_Death_Rate_Rural", "Crude_Death_Rate_Urban")
head(data)
```
### About the Dataset
```{r}
str(data)
```
### Summary of Dataset
```{r}
summary(data)
```
## Univariate Analysis {.tabset} {#univariate-analysis}
### Histogram for Crude Birth Rate - Total
```{r}
ggplot(data, aes(x=Crude_Birth_Rate_Total)) +
geom_histogram(aes(y=..density..),breaks= seq(10,30,by=2),
fill="blue",color="black",alpha=0.7) +
geom_density(color="red",size=1) +
ggtitle("HistogramwithDensityofCrudeBirthRate-Total") +
theme_minimal()
```
### Histogram for Crude Death Rate - Total
```{r}
ggplot(data, aes(x=Crude_Death_Rate_Total)) +
geom_histogram(aes(y=..density..),breaks= seq(5,10,by=0.5),
fill="green",color="black",alpha=0.7) +
geom_density(color="red",size=1) +
ggtitle("HistogramwithDensityofCrudeDeathRate-Total") +
theme_minimal()
```
### Histogram with breaks and density for Crude Birth Rate - Rural
```{r}
ggplot(data, aes(x=Crude_Birth_Rate_Rural)) +
geom_histogram(aes(y=..density..),breaks= seq(10,35,by=2),
fill="purple",color="black",alpha=0.7) +
geom_density(color="red",size=1) +
ggtitle("HistogramwithDensityofCrudeBirthRate-Rural") +
theme_minimal()
```
### Histogram with breaks and density for Crude Death Rate-Rural
```{r}
ggplot(data, aes(x=Crude_Death_Rate_Rural)) +
geom_histogram(aes(y=..density..),breaks= seq(5,10,by=0.5),
fill="orange",color="black",alpha=0.7) +
geom_density(color="red",size=1) +
ggtitle("HistogramwithDensityofCrudeDeathRate-Rural") +
theme_minimal()
```
### Histogram with breaks and density for Crude Death Rate-Urban
```{r}
ggplot(data, aes(x=Crude_Death_Rate_Urban)) +
geom_histogram(aes(y=..density..),breaks= seq(2,8,by=0.5),
fill="brown",color="black",alpha=0.7) +
geom_density(color="red",size=1) +
ggtitle("HistogramwithDensityofCrudeDeathRate-Urban") +
theme_minimal()
```
### Histogram with breaks and density for CrudeBirthRate-Urban
```{r}
ggplot(data, aes(x=Crude_Birth_Rate_Urban)) +
geom_histogram(aes(y=..density..),breaks= seq(10,25,by=2),
fill="cyan",color="black",alpha=0.7) +
geom_density(color="red",size=1) +
ggtitle("HistogramwithDensityofCrudeBirthRate-Urban") +
theme_minimal()
```
## Bivariate Analysis {.tabset} {#bivariate-analysis}
### Boxplot for Crude Birth Rate - Total
```{r}
ggplot(data, aes(x = "", y = Crude_Birth_Rate_Total)) +
geom_boxplot(fill = "lightblue") +
ylab("Crude Birth Rate - Total") +
ggtitle("Boxplot of Crude Birth Rate - Total") +
theme_minimal()
```
### Boxplot for Crude Birth Rate - Rural
```{r}
ggplot(data, aes(x = "", y = Crude_Birth_Rate_Rural)) +
geom_boxplot(fill = "lightgreen") +
ylab("Crude Birth Rate - Rural") +
ggtitle("Boxplot of Crude Birth Rate - Rural") +
theme_minimal()
```
### Boxplot for Crude Birth Rate - Urban
```{r}
ggplot(data, aes(x = "", y = Crude_Birth_Rate_Urban)) +
geom_boxplot(fill = "black") +
ylab("Crude Birth Rate - Urban") +
ggtitle("Boxplot of Crude Birth Rate - Urban") +
theme_minimal()
```
### Boxplot for Crude Death Rate - Total
```{r}
ggplot(data, aes(x = "", y = Crude_Death_Rate_Total)) +
geom_boxplot(fill = "lightcoral") +
ylab("Crude Death Rate - Total") +
ggtitle("Boxplot of Crude Death Rate - Total") +
theme_minimal()
```
### Boxplot for Crude Death Rate - Rural
```{r}
# Boxplot for Crude Death Rate - Rural
ggplot(data, aes(x = "", y = Crude_Death_Rate_Rural)) +
geom_boxplot(fill = "lightyellow") +
ylab("Crude Death Rate - Rural") +
ggtitle("Boxplot of Crude Death Rate - Rural") +
theme_minimal()
```
### Boxplot for Crude Death Rate - Urban
```{r}
ggplot(data, aes(x = "", y = Crude_Death_Rate_Urban)) +
geom_boxplot(fill = "lightpink") +
ylab("Crude Death Rate - Urban") +
ggtitle("Boxplot of Crude Death Rate - Urban") +
theme_minimal()
```
## Multivariate Analysis {.tabset} {#multivariate-analysis}
### Scatter plot: Crude Birth Rate - Total vs Crude Death Rate - Total
```{r}
ggplot(data, aes(x = Crude_Birth_Rate_Total, y = Crude_Death_Rate_Total)) +
geom_point(color = "blue", size = 3, alpha = 0.7) +
geom_smooth(method = "lm", se = FALSE, color = "red") +
ggtitle("Crude Birth Rate vs Crude Death Rate (Total)") +
xlab("Crude Birth Rate - Total") +
ylab("Crude Death Rate - Total") +
theme_minimal()
```
### Scatter plot: Crude Birth Rate - Rural vs Crude Death Rate - Rural
```{r}
ggplot(data, aes(x = Crude_Birth_Rate_Rural, y = Crude_Death_Rate_Rural)) +
geom_point(color = "green", size = 3, alpha = 0.7) +
geom_smooth(method = "lm", se = FALSE, color = "red") +
ggtitle("Crude Birth Rate vs Crude Death Rate (Rural)") +
xlab("Crude Birth Rate - Rural") +
ylab("Crude Death Rate - Rural") +
theme_minimal()
```
### Scatter plot: Crude Birth Rate - Urban vs Crude Death Rate - Urban
```{r}
ggplot(data, aes(x = Crude_Birth_Rate_Urban, y = Crude_Death_Rate_Urban)) +
geom_point(color = "purple", size = 3, alpha = 0.7) +
geom_smooth(method = "lm", se = FALSE, color = "red") +
ggtitle("Crude Birth Rate vs Crude Death Rate (Urban)") +
xlab("Crude Birth Rate - Urban") +
ylab("Crude Death Rate - Urban") +
theme_minimal()
```