 It's LinkedIn Learning author Monica Wahee with today's data science makeover. Watch while Monica Wahee demonstrates how to drop a column in R using the column number. Hi everyone, so today we are going to drop a column. Before we start let me remind you, dear Dorothy, that we are not in SQL anymore. There are about a zillion ways to drop a column in R and they all require much too much programming in my opinion. I'm going to show you my favorite way which involves our old friend the witch command, but first things first. I just read in the demonstration data frame called line items. It is in RDS format. And then I ran a call names command so you can see the column names. If you have questions about either of these commands, just go look in the description to this video for some links. But for those of you who are with me, you can see up here on the console, we have evidence our data frame is in there because we can see that the column names are up here. And specifically we can see that cost row ID is the fourth column in the data set. So let's say we wanted to drop that column. Since it's obvious it's the fourth column, we could just say some simple code like the code I have here. See that little arrow? We could create a data frame called line items to without the fourth column by putting the little arrow and on the right side, putting line items with brackets and nothing in the row position. And in the column position, we put four for the fourth column. But we add the negative sign, which is our way of telling our actually, when you make line items to get rid of the fourth column, negate it. So we could run that code and it would make line items to without the fourth column. But normally, we aren't going to know the column number in our data. Got big data? Trust me, if it's wide, you'll be crying inside. And so you'll want to do it my way. See the code up here? It is identical to the code below, except that the four is being represented by this variable cost row ID underscore CN. The CN stands for column number. So what I did was I made our figure out the column number from the which command and stored in this variable. Then I use that variable to drop the column by number in this code. See this code up here? This is how I got R to put the value for for the fourth column in the data frame cost row ID into this variable cost row ID underscore CN using the which command. I'll link to a video where I go over that more carefully. Look in the description. Okay, now I'm going to run these top two codes, the which code above and the code to drop the column below. Okay, let's see if that worked. We'll go down here and run a call names command on our new data set that we created without the drop variable named line items two. Look at that column totally dropped. Success. Feel so good to shed unwanted columns processing go so much faster. And that's our 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.