 In this video, I want to show you how to do groupings and we're going to use the group reduce function. In the previous video, we reduced some of the columns and that reduction allowed us to look at the minimum and maximum value along a column to express the mean or variance of that to sum all of the values. So a lot of statistical tests we can do on a column. But what if we want to group first according to some other variable and then do a reduction? So I'm going to hit escape and enter or return and two pound signs and I'm going to type in grouping because this is going to be all about grouping. So we're going to use this group reduce. Let's type that in group reduce and it's a function. And what we want, for instance, let's look at table two again. We know what table two is all about. And what if we want to calculate the mean of the HB column? And if we go down that HB column, we don't want the mean of the whole column. We want the mean calculated separately for each of the unique values found in the group. Now remember group had Roman numerals one, two and three as the sample space of that categorical variable. So if I want all the ones together and their HB mean, all the twos together and their HB mean and all the threes together and their HB mean. So let's try and do that. Again, we have loaded the online stats. So I can just use mean. I'm going to say please do this on table two. So let's select table two. I want the group. I want this to be categorized by the group column. And the select, again, that is what I want this mean to be calculated on. And let's make that the HB column. And there we go. We see in the group column, we found values one, two and three. And we'll separately do the mean of the HB of each of these. So the mean in group one is 14. And mean in group two is 10. And mean in group three was 13. So you can do that individually. Let's try that one more time. And let's just look at the variance for these. So it's group reduce. Once again, I want the variance, variance. Remember after that comes the object, which is table two. And then comes the column by which we want to group. I'm using symbol notation, hence the colon. And then what I want this variance to be calculated on exactly, and that is HB. And there we again, we see one, two and three and the variance for each of these. Very easy to do. Now I need not stick to the variance and mean. I can use any of the inbuilt Julia functions. And for that though, I'm not going to use the group reduce. I'm going to use the group by. Now have a look at this. So not only is the group reduced but group by. And what I want to do here is just list a bunch of functions inside of Julia. So I'm going to say the mean. I'm going to say the median for instance. I'm going to say the standard deviation, which is this STD var for the variance. And let's do the quartiles. That's going to be the minimum, the first, the second quartile. Remember the second quartile is the median, third quartile and the maximum. So all of them, we can get to all of them by using the quantile function. Quantile as you can see there. Then once again, I want this to be done on the table to object. I want it all to be done by whatever groups or whatever unique values are found in the group. And what I want all of this to be calculated on is the HB. It'll take a second or two and there we go. Look at all that beautiful descriptive statistics of our table in one go. We see the group had unique elements one, two and three. The roman numerals that made up the sample space of the group variable. And we see for HB we have a mean, a median, a standard deviation at square, which is the variance. And there's the minimum, first quartile, median. You see 13, 7 there and 13, 7 there. That's the same. That's the median. Third quartile and maximum value there. A single line of code gives me all of the descriptive statistics grouped by one of the categorical variables. And that is really, really useful to do. If you get data into a table very quickly for you, very quickly, you can come up with the descriptive statistics. Really, really powerful stuff.