In this video, we'll continue exploring mean and range charts. Our learning objectives are to generate the Xbar and R chart using our software and to assess the Xbar and R chart for process control. In R studio we use the following syntax to create the X bar and R chart, we continue where we left off with the Xbar.r.column data. The command that will use as spc.chart.variables.mean.and.meanrange. We'll need to define the arguments for data, which will be xbar.r.column and we'll choose the column called measure, it gives us the actual values. We also need to define the sample subgroup with sample and that will be the sample column. As you can see here. We have 1 2 3 4, 5 samples. I'm also going to give the chart 1 or the xbar chart, a title of xbar chart and chart 2 the chart below it, the title of R chart. And let's click run. Going to expand my screen before you do that and you'll see that we've created the X bar chart. Of course you might want to know some of the details associated with the chart. There is quite a bit of output that comes out of making the chart. However, some of these values are repeating and we want to extract what's pertinent to what we would like to know. So let's walk through an example of extracting control limits in the center line for each chart. I'm going to use the same command and the same data that I had for spc.chart.variables.mean and mean range. That this time I'm going to send it to an object called xbar.r.eval. So go ahead and click on that. And when I do that, I've just taken all of this output that you see here and put it into this object called xbar.r.eval. Now I'm going to extract what I would like out of this xbar.r.eval. Now if I type in xbar.r.eval and press the dollar sign, you'll see there's quite a bit of information from which I can select. So I'm going to select the control limits for the mean chart, the lower control limit. The upper control limit and the center line and put them into a data frame where it defines what the lower control limit is. The center line and the upper control limit. When we looked at the data before we saw that there were repeating values because with the line and each of these points, the data value repeats in order to create those lines. So I'm going to use a command called unique to pull out just one of those values and put it into the data frame. So let's go ahead and do that. And I'm going to put it into an object called lims which stands for limits.chart.1. And this is for the Xbar chart, click on run, and if I want to see those limits, I can just type in lims.chart.1 and there I have the lower control limit, this center line and the upper control limit. Likewise, we can do the same thing for the range chart. I'm going to use the xbar.r.eval, this time I'm going to use chart 2s control limits for the lower control limit, the centerline and the upper control limit. I'll click on run, and then let's take a look at the limits for chart 2, you'll notice that we don't have a lower control limit. We do have a center line of 0.0076 and an upper control limit of 0.0161. Next we'll assess the chart for process control. We'll be looking for points outside of the control limits, runs, trends, cycles, and any unusual patterns of variation. By default, L O L cat uses rules 1 through 4 on the control chart, if we'd like to change those rules, we'll have to do so in the commands, to evaluate the chart for control. Again, I'm going to send the output to an object. Now note here that I said that you could change the control rules. There are some rule sets in here that you can use. One of which is all of the rules, 1 through 8. To do that, you'll need to specify what the rule set is and there's two in there. I'll show you what the other one is. So we'll do that for chart 1 and I'm going to just do a shift enter to create a new line and type in chart 2 control rules equals to and I'll start typing spc rule sets. And you'll see that I have 1 2 3 and 4. We also have just outside limits as well for the rule sets. If you just wanted to use those, we're going to use the rule sets for 1, 2, 3 and 4 on chart 2 which is the default. And we will click on run, this creates the charts but now we want to evaluate to see if anything is out of control. Now we can visually look at it and see that it is in control. However, we can also run the following syntax. Since we sent this to an object, there is a section that evaluates the chart for control, it's called chart 1, is control violation and it'll give us the overall results. So if we have any out of control situations, we're going to use the any function and R. And this will tell us if there are any control violations in the Xbar chart as well as the range chart. And let's click run on those. And you'll see at the bottom here that there are no control violations for the mean chart and there are no control violations for the R chart. When we do have a control violation, we can use the L apply function to give us a list of all the control rule violations. We'll use the following syntax to do that for both chart 1 and chart 2. And you'll see that all of the rules, 1 through 8 come back as false meaning. We don't have any control limit violations for any of the rules and we're going to run the same on chart 2. We only had rules 1 through 4 operating for this control charts. So we have a list of those four rules. We can also determine which points are out of control, we'll use the L apply function again. But you'll see, we're not looking for any control violation. We're looking for specific control violations. So we'll run that and you'll see that for each of the control rules, we have 0, which means that there are no points are out of control. When we do have out of control points, it will give you the specific point that is out of control. So we just ran that for chart 1 or the main chart. We're going to run it for chart 2 and again, we have no out of control conditions.