Using ifelse with multiple conditions, getting warning longer object length is not a multiple of shorter object length

Hello, when working in Rstudio I have run into an error/warning message that I cannot seem to figure out. I am trying to use ifelse with multiple conditions from various columns in my dataframe. They are all the same length, just one contains more NA values.

Here is my code:
april2021$detection <- ifelse ((april2021$x <= april2021$y &
april2021$z > 3.5 &
april2021$z[findInterval(april2021$z, c(4,5.3)) == FALSE]), 1, 0)

Here is my error:
Warning in april2021$x <= april2021$y & :
longer object length is not a multiple of shorter object length

Please Advise

Thank you so much!! I didn't even think to fix that part!

The code that worked without an error message is as follows:
between(total_meters_april2021$z, 4, 5.3) == FALSE)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.