When changing column names, you may encounter a "Names must be unique" error

When changing column names, the following error may occur:

Error in rename(., Cost = Direct_Mail_Cost) : Names must be unique.
✖ These names are duplicated:
  * "Cost" at locations 7 and 8.

This error occurs when there are duplicate column names.

Therefore, the error can be resolved by adjusting the column names to ensure they are not duplicated.