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 categorical 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
ggplot2, code>dplyr, and
I have also changed the values of the
DaysOfWeek variable, if you wish to do that as well the code for that is :
flights$DayOfWeek <- wday(as.Date(flights$Full1_Date,'%m/%d/%Y'), label=TRUE)
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.
Construct a barplot which illustrates the number of flights per carrier.
Make a barplot which illustrates the number of flights per carrier and each bar also contains information regarding the number of cancellations per carrier.
Make a barplot which illustrates the number of flights per carrier but also for every carrier to have two bars that show the number of flights that were cancelled and the ones that departed.
Make a barplot that shows the proportion of cancelled flights per carrier.
Make seven barplots which illustrate the number of flights per carrier and each bar also contains information regarding the number of cancellations per carrier for every day of the week. hint:facet
Make one barplot which illustrates the number of flights per carrier and each bar also contains information regarding the number of cancellations per carrier for every day of the week.
Create a pie chart that illustrates the number of flights per carrier
Create a wind rose that illustrates the number of flights per carrier for every day of the week.
Make a heat map that illustrates the number of flights per carrier for every day of the week.
With the same data from the heatmap from the previous exercise, also provide some information regarding the cancellation ratio (2 digits recommended) and make customise the heatmap in order for the higher values to be more distinctive.
- Become a Top R Programmer Fast with our Individual Coaching Program
- Explore all our (>4000) R exercises
- Find an R course using our R Course Finder directory
- Subscribe to receive weekly updates and bonus sets by email
- Share with your friends and colleagues using the buttons below