I have a variable b which is of varying length.
Eg. it can be
b=0 or b=c(1,4,5)
I have an if condition stating that if
b=0 then it should do something.
Whenever b is not 0 or is of length larger than 1 I get the warning:
the condition has length > 1 and only the first element will be used
Basically what I would like to have is: if b=0 then do something otherwise do something else REGARDLESS of the length of the vector.
How should I do this properly?
b <- c(1,2,0)
, or should it "do something else"?