From the course: Data Visualization in R with ggplot2

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Box plots

Box plots

From the course: Data Visualization in R with ggplot2

Start my 1-month free trial

Box plots

- [Instructor] Boxplots are a tool that help us visualize a data set and provide a little more statistical insight than a simple scatter plot. I've already loaded by data set into R and now let's imagine that I want to look at how tuition varies for public versus private institutions. I might first try doing that using a scatter plot. I'm just going to call ggplot with the college data set and then add a point geometry that specifies that I would like control to appear on the x-axis and tuition to appear on the y-axis. Now before I run this code, take a moment and try to imagine what this plot will look like. I have tuition which is a continuous variable on the y-axis so those values should be spread out vertically, but then I have control on the x-axis. Control only has two possible values. It's a discrete variable. It can't take on anything within a range of values. Control is either going to be public or private. Let's go ahead and run this plot. When I do that, I get a rather…

Contents