I am using the following code in R to create a new variable called success in my dataset (leaders)
leaders$success <- as.numeric(leaders$result == 'dies within a day after the attack','dies between a day and a week','dies between a week and a month','dies, timing unknown')
It happens that the code above only compute the variable dies within a day after the attack. How should a rephrase the code in order to compute the other three variables? I tried using the OR operator, | but It is possible only for numeric arguments.
Could someone help me?