Change variable names

Hi there,
I would like to change the variable names in my data set but I receive an error. i do not understand why I cannot change the names just because they have missing values.

MDAA <- rename(MDAA, Sex motives = motive, Cyber victimization = Cyber,
In-person Victimization = person)

Here is the error:

Error: Selections can't have missing values.

  1. dplyr::rename(MDAA, SM = motive)
  2., SM = motive)
  3. tidyselect::eval_rename(expr(c(...)), .data)
  4. tidyselect:::rename_impl(...)
  5. tidyselect:::eval_select_impl(...)
  6. tidyselect:::vars_select_eval(...)
  7. tidyselect:::loc_validate(pos, vars)
  8. tidyselect:::check_missing(pos)

I would appreciate it if you please help me out.
Best wishes,

The problem may be the spaces in the new variable names. Try
MDAA <- rename(MDAA, `Sex motives` = motive)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.