Developing Data Products - Week 3 - Peer Project

Jayasree Kulothungan

29/08/2020 (click or use arrows to navigate through the slides)

Overview

In this project, we created a web page presentation using R Markdown that features a plot created with Plotly showing the cesnsus of age-groups in the city of Coimbatore, Tamil Nadu in 2011

Importing Libraries

library(plotly)
## Loading required package: ggplot2
## 
## 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

Read data and # Clean Data

data <- read.csv("Coimbatore_age_group_census_2011.csv")
data <- data[complete.cases(data),]
str(data)
## 'data.frame':    18 obs. of  5 variables:
##  $ Area.Name: chr  "Coimbatore (M Corp.)" "Coimbatore (M Corp.)" "Coimbatore (M Corp.)" "Coimbatore (M Corp.)" ...
##  $ Age.Group: chr  "0-4" "5-9" "10-14" "15-19" ...
##  $ Persons  : int  73071 71485 77295 78725 88749 98803 94240 93424 83531 73815 ...
##  $ Males    : int  37470 36590 39367 39176 41755 47001 47248 46552 43036 38063 ...
##  $ Females  : int  35601 34895 37928 39549 46994 51802 46992 46872 40495 35752 ...

Create a Plot

Here we create an interactive plot using plotly function (hover over the plot to see interactivity)

fig <- plot_ly(
        data= data,
        x= ~Age.Group,
        y= ~Persons,
        type = "bar"
)

Visualise the Plot

fig
## Warning: `arrange_()` is deprecated as of dplyr 0.7.0.
## Please use `arrange()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.