 It's LinkedIn learning author Monica Wahee with today's data science makeover. Watch while Monica Wahee demonstrates how to replace ugly old column names on an R data frame with shiny new ones. We're back with our famous line items dataset. I wanted to use something pretty generic for my demonstrations so you didn't get hung up on the content. So what's going on here? Before you got here, I read in the line items dataset it's in RDS format and if you don't know about that reading in a dataset with RDS format just go to one of the links in the description. I have a video for that and then I ran a column names command so I could see the ugly column names we are going to replace. I also have a video on that in case you want to watch it. It's linked in the description and here's what happened. It worked. I read it in and here are the column names. We have line item ID, report ID, report order, cost row ID and total cost. Total cost? I say totally ugly. Let's see what we can do about this. Okay we can do this one of two ways. The neat way I like but includes more modular code that is easy to manage and the way that works the same and uses less code but I don't like it because it's not modular and therefore it's hard to read and edit. Let's start by looking at my favorite way. Remember how there were five columns? Okay so I need to come up with five column names. I did and I put them in a vector called new underscore names. Are you familiar with making vectors? If not look at my make vector video. I'll link it in the description. Okay so I'm just naming the new columns new call one new call two and so on so you can see that my trick works but I admit these names are boring. It's for demonstration only. So what do I do with that character vector of boring column names? Right we see a little arrow a lesson sign followed by a dash and we know we are going to be making some sort of object or in this case modifying some sort of object. What object are we modifying? We are modifying the names of line items. So for some reason names is the command you use to say I'm talking about the headers in the line items data frame. It's like a command with one argument the data frame and what you are shoving into the names for the line items is guess what our new underscore names vector. Basically we are telling R to replace the names technically column names of the data frame line items with the values in our vector new underscore names. So I like this way because first you make the vector and then in the next step you shove the vector into the data frame with the names command but you don't actually have to make the first step of making the vector. You can just directly shove the names into the data frame. See here this is me directly shoving all the values from the vector into the data frame with the arrow. But remember I don't like that code. It's honestly hard to manage. So I'm going to ignore the second code which I don't like and run the first code that I like. So here we go. All right it ran. Now let's check it. Let's run a call names on it now and see if it has our new names. And here they are. So nice. Really lovely. Such an improvement. Well that was 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.