I don't think you understand the use of ifelse completely. Your condition (1 == 1) is always true, so you know the answer in advance. Moreover the result for positive and negative examples is the same.
You use ifelse
to test a vector on a certain condition. If a value in the vector abides to the condition the first value is returned, if it doesn't the second one is returned. For example;
test <- sample(letters[1:2], 100, replace = T)
ifelse(test == "a", 'is a', 'is b')
The result will always be of the same length as the input vector. If your return values have a length longer than 1, the ifelse
will be aborted if the length of the input vector is reached. This implies that values in the import vector remain unevaluated. So you typically don't want to use the ifelse
when your return values are longer than 1.