Oops! We wanted to keep the original column, but we forgot to use
remove! What can we do?
One solution is to join two columns using the
unite() function. If we wanted to join users' first and last names to make a full name, we'd write:
unite(users, name, first_name, last_name, sep = "_")
The arguments, in the order in which they appear, are the dataset name (
users), the new column's name (
name), the columns we want to join (
last_name), and the separator used to join them. We've used the underscore character here, but we could have omitted that; R unites using an underscore by default.