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

Histograms in R: (R Tutorial 2.3)


In this video, you will learn how to produce histograms in R modify the histogram to better present your data.

First you will learn what a histogram is and when it is appropriate to use a histogram for your data. Then you will see how to produce a histogram in R using the "hist" command and modify it from the default options in R. For example, you will learn to change the y-axis to represent a probability density rather than frequencies using "freq" argument or "prob" argument, change the x or y limits of a histogram in R using the "xlim" or "ylim" argument, and change the bin width using the "breaks" argument. In this tutorial we will also show you how to add a title to a histogram using "main" argument, add labels to the x-axis or y-axis using "xlab" or "ylab" arguments, rotate the values on the y-axis of a histogram using the "las" argument, add a density curve using "lines" command, change the color of the density curve in the histogram using "col" argument and finally change the width of the density curve in a histogram in R using the "lwd" 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