Recode variables
How can I recode my old variable into a new variable?
For example I have a variable which has three categories 1, 2 and 3. I want recode the variable so that 1 becomes 0 and 2,3 become 1. I'm not talking about labeling.
How can I recode my old variable into a new variable?
For example I have a variable which has three categories 1, 2 and 3. I want recode the variable so that 1 becomes 0 and 2,3 become 1. I'm not talking about labeling.
Comments
Hi @hashim.
I answered a question similar to yours with a small video, which I left here:
https://forum.cogsci.nl/index.php?p=/discussion/5671/ifelse#latest
You should use one of these examples:
Example1
ifElse(myoldvariable = 1, 0, 1)
Example2
ifElse(myoldvariable < 2, 0, 1)
Example3
ifElse(myoldvariable > 1, 1, 0)
...
Cheers,
Maurizio
Thank you. it’s helpful