Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Changing column data types
Basic data cleaning
8. Change multiple column names
Summary

Instruction

What if we want to change more than one column name? We can combine this into one command. Again using colnames(), we'll specify which column names we want to change and then provide the same number of names in the vector. In the example below, we're changing the name of the two email columns:

colnames(survey)[4:5] <- c("email_name", "email_domain")

Exercise

Change the names of the columns FirstName (1st position) and LastName (2nd position) to first_name and last_name.