Descriptive Analytics-Part 5: Data Visualisation (Continuous variables)

[This article was first published on R-exercises, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

downloadDescriptive Analytics is the examination of data or content, usually manually performed, to answer the question “What happened?”.

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 ggplot, geom_histogram, scale_fill_gradient,geom_point, geom_line, geom_boxplot, coord_flip, geom_violin.

For this set of exercises you will need to install and load the packages ggplot2 and dplyr.

install.packages('ggplot2')
library(ggplot2)
install.packages('dplyr')
library(dplyr)

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.

Exercise 1
Develop an histogram which illustrates the TaxIn variable.

Exercise 2
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.

Exercise 3
Make a scatter plot of ArrDelay in respect to Full_Date while illustrating each carrier with a different colour.

Exercise 4
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.

Exercise 5
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.

Exercise 6
With the same variables, plot a line chart.
Hint: set the parameter ,group in order to proceed

Exercise 7
Create a box plot which illustrates the mean of daily ArrDelay for every day of the week.

Exercise 8
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.

Exercise 9
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.

Exercise 10
Modify the violin plot, use different colour for every day of the week, remove the trim and the legends.

To leave a comment for the author, please follow the link and comment on their blog: R-exercises.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)