Marinstatslectures

Like Us on FacebookFollow Us on TwitterSubscribe to Us on Youtube!Join Us on Google+

Stacked Bar Charts, Clustered Bar Charts and Mosaic Plots in R: (R Tutorial 2.5)

In this video you will learn how to produce and customize stacked bar charts, clustered bar charts and mosaic plots for examining the relationship between two categorical variables in R.

Here we will explain when to use stacked bar chartsmosaic plots, and clustered bar charts for your data and how to produce them in R using "barplot" and "mosaicplot" commands, and "beside" argument respectively. We will also show you how to produce contingency table in R using the "table" command. Later in the video you will learn to express the bar chart in terms of conditional probabilities, add a legend using the "legend.text" argument, add a title using the "main" argument, label the x or y axis using "xlab" or "ylab" arguments, and rotate the values on the y-axis of a bar chart using the "las" argument. You will also learn how to change the colours of the bars using the "col" argument.

We recommend using the link below to download the dataset and practice on your own while watching this tutorial. 

 

You can access and download the dataset that was used in this tutorial here:

  Tab Delimited Dataset for R TutorialsExcel Dataset for R Tutorials

Previous Video in Series 2 R Tutorials Next Video in Series 2 R Tutorials

Back to Series 2 R Tutorials