From the course: R Essential Training: Wrangling and Visualizing Data
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Creating histograms
From the course: R Essential Training: Wrangling and Visualizing Data
Creating histograms
- [Instructor] When you have something that you're counting or measuring, that is, when you have a quantitative variable, probably the most helpful graph you can make is a histogram or a bell curve. And we can do this using ggplot. Let's start by loading up some packages. And then what I'm going to do is I'm going to first show you, not a data chart, but a probability density function. We're just going to make a bell curve, just the curve itself. I'm going to do this by using ggplot and then data frame, and then I'm saying start from negative four and go to positive four, and we're just going to make a graph of x. Now, this really just sets out what the background is. We're going to save that into P for probability. And then I'm going to add stat function, the function is equal to d normal, the density of the normal distribution. Size means how thick to make the line. Here is a color, that's blue. We're going to put…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Introduction to ggplot24m 39s
-
(Locked)
Using colors in R5m 3s
-
(Locked)
Using color palettes8m 5s
-
(Locked)
Creating bar charts9m 22s
-
(Locked)
Creating histograms5m 30s
-
(Locked)
Creating box plots5m 24s
-
(Locked)
Creating scatterplots5m 58s
-
(Locked)
Creating multiple graphs4m 6s
-
(Locked)
Creating cluster charts8m 34s
-
-
-
-