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

Unlock this course with a free trial

Join today to access over 22,700 courses taught by industry experts.

lattice: barchart

lattice: barchart

- [Instructor] Lattice provides bar charts an bwplots also known as box-and-whisker plots. So, let's take a look at those two. Don't forget to bring in the lattice library and you'll do that by typing library parenthesis lattice. And now, we can use barchart. I'll type in barchart and don't forget we're using formulas so it's weight against time and the next queues I use the plus sign to condition the data. That's just the way barchart wants it. And the data will come from chickweight. And when I run that, I receive a pretty standard bar chart. Now, what happens if we move that formula around? Well, let's try. Here's barchart again. And this time, instead of weight against time we're going to use diet against weight. And we're bring in the data from chickweight again. And when I run that you'll notice that it immediately goes to a horizontal instead of a vertical. And relationships have changed too because…

Contents