 It's LinkedIn learning author Monica Wahee with today's data science makeover. Watch while Monica Wahee demonstrates how to delete rows from a data frame based on column criteria in R. It's Monica and I'm back with our line items data set, which is my demonstration data frame for you. You'll see I have the read RDS code here where I read in the line items data set. If you don't know how to do that, just look in the description, there's a link to a video there for you. Then I ran the object line items so you could see what's in the data frame. You'll see here in the console that the line items data set has only five columns. Today we are going to use this variable tot underscore cost. It probably means total cost. As the column on which we set the criteria or in our case criteria on, I just had one to demonstrate. See some of these costs are above $100 and some are below $100. So that's what we are going to do for the criteria. Actually, let's cut to the chase and look at the subset command. First, please note that we are making something. We are making a new data frame line items too. We are not overwriting the old data frame. It's kind of important because what if we get cold feet and we want some of those rows we removed back? Okay, now to get rid of the rows where tot underscore cost is too low for us, which is under $100. We will use the subset command, which has these two arguments. It's time for some exciting arguments. Here are two arguments. The first argument is the original data set, which is line items. Then we have a comma and the second argument is the criteria part. Are the criteria part? Here we are saying we want to keep the rows where tot underscore cost is greater than $100. You can use these arithmetic functions in R. You know, look in the description. I'll link you to a great webpage I use as a reference for that. Okay, we could just run this code, but it's better if we prepare. It's better if we first look at the number of rows in the original data set because remember, we are going to be supposedly removing rows, so we need to know what we start with. And if you think about it, we'll want to know the number of rows we have left when we are done subset. So that's why all my subset commands are a sandwich between nrow commands, the top one for the original data set line items, and the bottom one for the data set after the subset, which I am calling line items too. If you are unfamiliar with the nrow command, look in the description for a link to my video. All right, I'm going to highlight this whole thing and make it run. It ran. Nothing more validating. All right, let's look at the console. See that? There were 95 rows, but after we removed the ones with a tot underscore cost of less than $100, we were only left with 72 rows. Actually, let's look at the new line items to data set. I'm going to run it to the console. See that? None of the small costs under $100 are in there. We clean them out. Feel so fresh and so nice, like a brand new data frame. And that's your data science makeover for today. Thank you for watching this data science makeover with LinkedIn Learning author Monica Wahee. Remember to check out Monica's data science courses on LinkedIn Learning. Click on the link in the description.