 Okay, so another really common plot type is the bar plot. So let's go ahead and look at some examples of that. We're gonna start again by copying over our code block from the previous examples. But we're gonna make several changes here. Okay, one is to change the geometric function to g on bar. But we're also gonna remove one of our variables from the ggplot function in the first line. Okay? The reason for this is because by default, the g on bar function only takes specifications of our x variable. The y is actually set to a default value and you'll see why as we run this. Okay, so once we run this, you can see that the y variable has already kind of been set to a default of the count of records in each of these categories. Okay, so because our x value here is this categorical variable, what's basically happening is r is just binning all these values in those four, the four levels of that categorical variable. If you want to add some color here, we can introduce the aesthetic function inside the parentheses. We're gonna use the fill argument set fill to village. So just as we did in our previous case, we're gonna use this village variable to define the color. Okay, we're using fill instead of color because with these bar plots, they distinguish between kind of the outline which would be set by color and the fill which is set by this argument fill. The result is that we get this stacked bar plot with all the different villages or values for villages kind of stacked one on top of the other. Okay, and this might not be ideal because again you have to kind of eyeball this to find out how many records are in each of those bins. So if you want this to present side by side instead of the stacked bar chart, you use this additional argument called position and then in quotation marks, right dodge. Okay, and so now this is separating these different villages into different bands is adjusting the y axis to just contain you know smaller number of counts so you can kind of see all this data groups together. Okay, so this is an improvement over the stacked bar chart, it's a bit clear, simpler to read. But we might still prefer rather than looking at the counts, maybe we're interested in looking at the proportion of records that fall into these different things and maybe instead of the cement which is only you can see here, kind of occupying this very small range the data maybe we want to exclude that altogether and get kind of a better picture of just those three more kind of dominant construction materials. So this is not something that we can create just using our code from before it's not something that you can do within the ggplot kind of set of functions. Instead, what we're going to need to do is alter the the raw data that's being fed into these ggplot ggplot functions. Okay, so what we're going to do here first is create a new object and we're actually going to call this object percent wall type. And we're going to feed interviews plotting object into this function, followed by a pipe here. The first thing we're going to do that I mentioned is we're going to get rid of all the records where the respondent wall type is equal to submit. Okay, so if you remember from our introduction to our workshop that filter is basically using criteria, row level criteria to filter out all of the records that satisfy the criteria so in this case we're saying we don't want any records where the respondent wall type is equal to submit. So remember that exclamation point is as a negation operator, so not equal to submit. Follow this up with another pipe. First thing we're going to do is get a village level count records in each category, each level of that variable. Follow this by grouping our data by the village. Here we're going to use the mutate function to add a new attribute to the data set. We didn't have percent calculated in our previous, the original version of our data so here we're going to create it. So here we're just saying what we want that new field name to be named. And then we're going to tell our how to calculate it. So we're going to take in which is the count that's generated here. Okay, and we're going to divide that by the total number of records or the sum of n. Multiply that by 100 because this is going to be represented as a decimal place as a percentage. The last thing that we're going to do is ungroup this. There's a lot going on here if you're getting confused about how these different functions work or what they're doing. I would just encourage you to refer back to the introduction to our workshop that's going to give you a bit more context about these. Okay, so let's go ahead and give this a shot. Make sure there are no errors. You can see that it created my object successfully. It's now jumped up here into my global environment. It's got nine observations of four variables.