In order to be able to solve this set of exercises you should have solved the part 0, part 1, part 2,part 3, and part 4 of this series but also you should run this script which contain some more data cleaning. In case you haven’t, run this script in your machine which contains the lines of code we used to modify our data set. This is the sixth set of exercise of a series of exercises that aims to provide a descriptive analytics solution to the ‘2008’ data set from here. This data set which contains the arrival and departure information for all domestic flights in the US from 2008 has become the “iris” data set for Big Data. The goal of Descriptive analytics is to inform the user about what is going on at the dataset. A great way to do that fast and effectively is by performing data visualisation. Data visualisation is also a form of art, it has to be simple, comprehended and full of information. On this set of exercises we will explore different ways of visualising continuous variables using the famous
ggplot2 package. Before proceeding, it might be helpful to look over the help pages for the
For this set of exercises you will need to install and load the packages
Answers to the exercises are available here.
If you obtained a different (correct) answer than those listed on the solutions page, please feel free to post your answer as a comment on that page.
Develop an histogram which illustrates the TaxIn variable.
Let’s make things a bit fancier, illustrate the histogram of TaxiIn variable, with range from 0 to 50, while they break by 2 ,the highest values will be filled with red and the lowest will be filled with green and finally add a title.
Make a scatter plot of ArrDelay in respect to Full_Date while illustrating each carrier with a different colour.
Create a new variable called mean_delay which is the mean of
ArrDelay for each carrier every day.
Now make a scatter plot of
Mean_ArrDelay in respect to
Full_Date while illustrating each carrier with a different colour.
Make the previous plot a bit more appealing by changing the
alpha parameter of the data points, the theme of the points , and by inserting names to the x-axis and y-axis.
With the same variables, plot a line chart.
Hint: set the parameter ,
group in order to proceed
Create a box plot which illustrates the mean of daily
ArrDelay for every day of the week.
Modify the box plot by setting a colour and a size for the outliers, also make every day of the week to be illustrated with a different colour. Also, if you wish and your screen is not big enough, remove the legend.
While box plot is a great way to demonstrate distributions, an even better way are violin plots. Plot a violin plot with the same data.
Modify the violin plot, use different colour for every day of the week, remove the
trim and the legends.