From the course: R for Data Science: Lunch Break Lessons

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

spineplot

spineplot

- [Instructor] Spineplots are a special kind of histogram where the width of the bar indicates the frequency of x, and the height of the bars indicates the frequency of y. Spineplots are built-in to R and they're easy to use. Here's how. The command is spineplot, and you give it an x and a y. So in this case, let's plot ChickWeight weight against ChickWeight Diet. And in the right-hand corner, you'll see that I have ChickWeight Diet versus ChickWeight weight. The width of the bars indicates the frequency of the x, or the weight, and the height of the bars indicates the number of observations of diet. Spineplot provides an alternate way to describe a spineplot using a formula. And here's how it looks. Rather than this, we'll just type in Diet against weight, and the data is going to come from ChickWeight. And this'll produce the same graph a little bit cleaner. Now there are a lot of bells and whistles we can put on a spineplot. So let's start with the same command, but I'm going to…

Contents