title: How to test if a function argument is a "quosurable" name?
body: <p>I'm making a function that should be able to handle multiple classes for its first argument: formulas, characters, tidy-selection, var names... The goal is then to use tidyselection with <code>tidyselect::vars_select</code>, except with bare formulas.</p>
  
  <p>The problem is that when I test the class of this argument, it will throw an error if the value is a name to be tidy-selected, since it will be considered as a not found object.</p>
  
  <p>I found a workaround with <code>tryCatch</code>, which enquotes the first argument if its evaluation fails (and thus if it doesn't exist in this scope).  </p>
  
  <pre><code>library(rlang)
  foo=function(.vars){
      .vars2=tryCatch(.vars, error=function(e) enquo(.vars))
      print(class(.vars2))
      print(class(.vars))
  }
  
  foo(Species) 
  # [1] "quosure" "formula"
  # Error in print(class(.vars)) : object 'Species' not found
  # In addition: Warning message:
  # In print(class(.vars)) : restarting interrupted promise evaluation
  
  foo(~Species)
  # [1] "formula"
  # [1] "formula"
  
  foo(1) 
  # [1] "numeric"
  # [1] "numeric"
  
  foo("Species")
  # [1] "character"
  # [1] "character"
  </code></pre>
  
  <p>This doesn't seem clean to me, as I'm catching all errors without filtering on my specific case.</p>
  
  <p>Is there a built-in function to test this, or a cleaner solution than this workaround?</p>