I want to create another binary variable y
condition on different categories of the variable x
.
if the variable x
is "a" or "b" or "c" I want y
to be equal to 1, if x
is "d" or "e" y=0
My code is as follows
data$y <- ifelse(data$x == "a" | data$x == "b" |data$x == "c", 1,
ifelse(data$x == "d" | data$loan_status == "e" ,0))
I am receiving an error :
argument "no" is missing, with no default"
I have checked other similar questions but that does not solve my problem.