Key Concepts

Review core concepts you need to learn to master this subject

Histograms In R

# Creates a histogram of the Ozone feature from the dataset airquality. In this case, each bin will have a width of 10. airquality_histogram_binwidth <- ggplot(airquality, aes(x = Ozone)) + geom_histogram(binwidth = 10)

In R, the geom_histogram() function from the ggplot2 library will create a histogram. The binwidth argument sets the width of the bins in the histogram.

If the binwidth argument is not used, the histogram will create 30 bins by default of equal size. It is recommended to use the binwidth argument to make the histogram smoother.

Histograms are used to visualize the distribution of a continuous variable.

Intermediate Data Visualization in R
Lesson 1 of 1

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo