I am trying to create a new variable called exp_error in the same dataset that takes the value “FALSE” whenever experience is negative, and “TRUE” otherwise. In the line that does this, I keep getting an error Message.
mutate(india04_new, exp = age - 18)
mutate(india04_new, exp_error = ifelse(exp > 0, "TRUE", "FALSE"))
Error message:
Error in exp > 0: comparison (6) is possible only for atomic and list types
Traceback:
1. mutate(india04_new, exp_error = ifelse(exp > 0, "TRUE", "FALSE"))
2. mutate.tbl_df(india04_new, exp_error = ifelse(exp > 0, "TRUE",
. "FALSE"))
3. mutate_impl(.data, dots, caller_env())
4. ifelse(exp > 0, "TRUE", "FALSE")
Aucun commentaire:
Enregistrer un commentaire