How to apply a function to multiple columns and generate a new column as a result?

library(dplyr)

# Sample data in a copy/paste friendly format, replace this with you own data frame
sample_df <- data.frame(
       index = c(23L, 86L, 96L, 111L, 121L, 140L, 153L),
  prediction = c(22.707441,13.568034,9.138957,26.375961,
                 21.65696,10.715798,20.579496),
    response = c(25, 13, 12, 22, 19, 14, 19),
         lwr = c(21.762679,12.789159,7.628405,25.559815,
                 20.738612,9.56118,19.985751),
         upr = c(23.6522,14.34691,10.64951,27.19211,
                 22.57531,11.87042,21.17324)
)

# Relevant code
sample_df %>% 
    mutate(result = if_else(response > lwr & response < upr, "yes", "no"))
#>   index prediction response       lwr      upr result
#> 1    23  22.707441       25 21.762679 23.65220     no
#> 2    86  13.568034       13 12.789159 14.34691    yes
#> 3    96   9.138957       12  7.628405 10.64951     no
#> 4   111  26.375961       22 25.559815 27.19211     no
#> 5   121  21.656960       19 20.738612 22.57531     no
#> 6   140  10.715798       14  9.561180 11.87042     no
#> 7   153  20.579496       19 19.985751 21.17324     no

Created on 2022-02-16 by the reprex package (v2.0.1)

Note: Next time please provide a proper REPRoducible EXample (reprex) illustrating your issue.

Also, if you want to learn more about this, you can read this free online book.

https://r4ds.had.co.nz/