Overview

This makeover is created to visualise the nature of the modes of transport in Singapore from 2012 to 2018. As there are different modes of transport in Singapore, I would like to understand the performance and trends of these transport.

1. More information on the Visualisation

2 graphs were illustrated to show the behaviors of commuters when taking the public transport.

2 more graphs were used to visualise the population and the number of mileage ran by private vehicles.

The average distance traveled per trip by each public transport is represented by line graphs. Each line represent one mode of public transport.

4 pie charts are used to show the average number of riders for each public transport for 2016, the population distribution and the annual mileage ran by different types of private vehicles across the 6 years .

A grouped multi bar chart is created to visualise the annual average mileage ran by different types of private vehicles across the 6 years. This interactive multi bar chart can be converted to stack bar chart to observe the rise and fall of the mileage between years.

1a. Major Data and Design Challenges faced

While attempting to visualise the dataset, there were several data and design challenges faced.

1. Data Challenges

  • Too many datasets

2. Design Challenge

  • Unable to knit interactive multi bar chart

1a.1. Too many datasets

There were several datasets gathered for private vehicles. However, as they come from different sources, I want to join these datasets together such that it will be easier for me to call out columns of the datasets that I need. To do so, I use the full join function in dplyr to combine the datasets together. This will help us to join the different datasets into one for easy referencing.

1a.2. Unable to knit interactive multi-bar chart

After the multi-bar chart is plotted, I tried to knit the R Markdown document to R Pubs. However, I faced the error that says opts_current not found (Refer to Figure 1). Therefore, instead of directly knitting and publishing it to R Pubs, I saved the graph to a html file before inserting a hyperlink in the R Markdown document. To do so, I used the save() function. After which, I pasted the path of the graph that I saved so that it remains interactive and visualisable for users to understand the graph better.

Figure 1. Error message when knitting R Markdown

1b. Sketch of Proposed DataViz Design

Figure 3. Proposed Sketch Design with the amended changes

2. DataViz Step-by-Step Description

2a. Install and load R packages

  • tidyverse is a set of essential packages to install and load core packages within one command.
  • readr is designed to read and import most types of rectangular data (eg: .csv) in an efficient way.
  • plotly is is an R package that is used to create interactive web-based graphs and has ggplotly function which converts ggplot2 figures into Plotly object.
  • dplyr is manipulating the data. It is designed to abstract how data should be stored.
  • readxl is designed to read excel data (data with xlsx).
  • rCharts is used to create a wide range of interactive graphics for graphs.
  • highcharter package allows access to Highcharts JavaScript graphics library. It can be used to create interactive line charts.
library(devtools)

packages= c('tidyverse', 'readr', 'plotly', 'dplyr', 'readxl', 'highcharter', 'DT', 'devtools')

install_github("ramnathv/rCharts")

library(rCharts)

for(p in packages){
  if(!require(p,character.only = T)){
    install.packages(p)
  }
  library(p,character.only = T)
}

2b. Load data in

Loading all datasets together before joining/appending some of them together

priv_pop <- read_excel("vehicles information.xlsx")

priv_mileage <- read_excel("vehicles average mileage.xlsx")

pub_trans = read_csv("public transport avg ridership.csv")

2c. Full outer join to combine tables of Private Vehicles

priv_veh <- full_join(priv_pop,priv_mileage,by="id")

2d. Understanding Datasets

2di. Public Transport

Run the dataset using the datatable function to display data for Public Transport

datatable(pub_trans)

2dii. Private Vehicles

Run the dataset using the datatable function to display data for Private Vehicles

datatable(priv_veh)

2e. Preparing the Dataset

Before I set to plot the interactive pie chart with plot_ly, I will create a new data frame with data.frame() function to rename and reorder the columns.

Create a new Data Frame before transposing this dataset

pubt <- data.frame(
                 tot = pub_trans$transport,
                 year = pub_trans$year,
                 riders = pub_trans$avg_ridership)

2f. Graphs for Visualisation

2fi. Plotting an Interactive Pie Chart with R

Plot an interactive pie chart using plot_ly() function of Plot_ly R. This will allow the users to be able to freely explore the graph.

  • For instance, the user can hover his/her mouse to the points on the pie chart and information about ridership for different modes of public transport will be shown like a tooltip.

Two pie charts are create to visualise on the average ridership for the different modes of public transport for year 2015 and 2016. According to the line graph above, there was a dip in the average distance traveled in year 2016 for MRT/LRT. Therefore, I would like to find out about the proportion for the different modes of transport and whether there was an increment in the average ridership from 2015 to 2016.

Year 2015

Year 2016

2fii. Create an Interactive Line Chart to show Average Distance Traveled Per Trip by Each Mode of Public Transport

An interactive line graph was created to visualise the average distance traveled per trip for each mode of transport.

2fiii. Create an Interactive Pie Chart to show the population proportion for private vehicles

Two pie charts was plotted to show the population distribution proportion from 2012 to 2018. By having the pie chart, we will be able to compare and understand how the annual mileage differ when compared to population distribution.

2fiv. Create an Interactive Multi-Bar Chart to show annual mileage across the years by different vehicles

An interactive multi-bar chart was created to show the annual mileage ran by different vehicles.

Two options are made available on top of the hovering feature - 1. Grouped Bar Chart - Annual mileage ran by 4 different types of private vehicles were visualised into 4 bar graphs for each year. 2. Stacked Bar CHart - 1 combined bar graph is used to represent the total mileage ran for that year

  • The codes have been commented in R Markdown as the problem faced when knitting still exists. This set of codes have been ran once to save it as html so that it can be published in R Pubs. *

Mileage Across Years by Different Vehicles

3. Final Data Visualisation

Pie Charts, a Multi-Bar Chart and a Line Graph diagram are created to visualise both types of transport - public and private.

After analysing these charts, the main insights gained are:

  • Decrease in average distance traveled per trip for MRT/LRT and Buses but increase for Taxi
  • More common for commuters to ride Bus than MRT/LRT and taxi
  • Private Vehicles for personal use have higher proportion in population but travels lesser than those for commercial use
  • Private vehicles travel around most at 2012 and least at 2018
3a. There is a decrease in average distance traveled per trip for MRT/LRT and Buses but increase in average distance traveled for Taxi

From the line graph for the average distance traveled, commuters generally travel more with MRT/LRT than Bus. Since commuters are traveling shorter distances with MRT/LRT and Buses and Taxis have an increasing average distance over time, commuters may have only commuted MRT/LRT or buses when they are traveling to nearby places and may have relied more on Taxis when traveling to further places.

3b. It is more common for commuters to ride Bus than MRT/LRT and taxi

According to the pie chart, bus has a higher proportion (49.2%) for the average annual ridership than MRT/LRT and taxi. Although MRT has a higher average distance traveled per trip, more people travel by buses. This also meant that more commuters travel by buses for short trips and they usually only turn to MRT/LRT for trips of longer distance. But buses are the preferred choice by the majority.

3c. Private Vehicles for personal use has a higher proportion in population but they travel lesser than those private vehicles for commercial use

Private vehicles for personal use (i.e. Cars and Motorcycles) stand a larger proportion of the population distribution (81.5% of the population distribution) for private vehicles as compared to private vehicles that are used for commercial purposes. However, the mileage ran by commercialized vehicles takes up 73.5%. This means that more people use private vehicles for commercial purposes rather than for personal use or as a means of transport.

3d. The private vehicles travel around the most at 2012 and the least in 2018

According to the multi bar chart, private cars in general travel the most during year 2012 and the least in 2018. The average annual mileage has been decreasing since 2014 (Select on Stacked to observe the trend of the average mileage).