 The next step in our introduction and our discussion of basic graphics is bar charts. And the reason I like to talk about bar charts is this because simple is good. And when it comes to bar charts, bar charts are the most basic graphic for the most basic data. And so they're a wonderful place to start in your analysis. Let me show you how this works just try it in our open up the script and let's run through and see how it works. When you open up the file in our studio, the first thing we're going to want to do is come down here and open up the data sets package. And then we're going to scroll down a little bit and we're going to use a data set called mt cars. Let's get a little bit of information about this do the question mark and the name of the data set. This is motor trend. That's a magazine car road tests from 1974. So you know they're 42 years old. Let's take a look at the first few rows of what's in mt cars by doing head. And I'm going to zoom in on this. And what you can see is that we have a list of cars the Mazda RX4 and the wagon the Datsun 710 the AMC Hornet. And I actually remember these cars. And we have several variables on each of them we have the MPG miles per gallon, we have the number cylinders the displacement and cubic inches, the horsepower, the final drive ratio, which has to do with the axle. And then we have the weight and tons the quarter mile time in seconds and these are a bunch of really, really slow cars. VS is for whether the cylinders are in a V or whether they are in a straight or inline. And then the AM is for automatic or manual. Then we go down to the next line we have gear, which is the number of gears in the transmission and carb for how many carburetor barrels they have, which is we don't even use carburetors anymore. Anyhow, so that's what's in the data set. I'll zoom back out. Now, if we want to do a really basic bar chart, you might think that the most obvious thing to do would be to use ours bar plot command, that's its name for the bar chart. And then to specify the data set MD cars, and then the dollar sign and then the variable that we want cylinders. So you think that would work, but unfortunately it doesn't. Instead, what we get is this, which is just kind of going through all the cases on a one by one by one row and telling us how many cylinders are in that case. That's not a good one. That's not what we want. And so what we need to do is we actually need to reformat the data a little bit. By the way, you would have to do the exact same thing if you wanted to make a bar chart in a spreadsheet like Excel or Google Sheets. It can't do it with the raw data. You first need to create a summary table. And so what we're going to do here is we're going to use the command table. We're going to say take this variable from this data set and make a table of it and feed it into an object, you know, a data thing, data container called cylinders, I'm going to run that one. And then you see that just showed up in the top left, let me zoom in on that one. So now I have in my environment, a data object called cylinders, it's a table. It's got a length of three, it's got a size of 1000 bytes, and it gives us a little bit more information. Let's go back to where we were. But now I've saved that information into cylinders, which just has the number of cylinders, I can run the bar plot command. And now I get the kind of plot I expected to see. From this, we see that we have a fair number of cars with four cylinders, a smaller number with six. And because this is in 74, we've got a lot of eight cylinder cars in this particular data set. Now, we can also use the default plot command, which I showed you previously on the same data, but it's going to do something a little different. It's actually going to make a line chart, where the lines are the same length of each bars, I'd probably use the bar plot instead, because it's easier to tell what's going on. But this is a way of making a default chart that gives you the information you need for the categorical variables. Remember, simple is good. And that's a great way to start.