Checking the presence of certain variables in a dataframe
I would do something like this:

tt &lt;- function() {
  naI &lt;- sapply(input_df[, c('var_in', 'var_out')], function(x) all(is.na(x)))
  if (sum(naI) == 2) {
    stop("both var_in and var_out are completely missing, so I cannot continue the EDA")
  } else {
    missing_variables &lt;- names(naI[naI == TRUE])
  }
  missing_variables
}


I put the code into function for testing. Tests:

input_df &lt;- data.frame(var_in = NA, var_out = 3)
tt()
#&gt; [1] "var_in"
input_df &lt;- data.frame(var_in = NA, var_out = NA)
tt()
#&gt; Error in tt(): both var_in and var_out are completely missing, so I cannot continue the EDA
input_df &lt;- data.frame(var_in = 3, var_out = NA)
tt()
#&gt; [1] "var_out"
input_df &lt;- data.frame(var_in = 3, var_out = 3)
tt()
#&gt; character(0)


P.S. maybe you also want to add some kind of treatment if the one/both columns are missing in data.frame...