title: Check expression argument of function
body: <p>When writing functions it is important to check for the type of arguments. For example, take the following (not necessarily useful) function which is performing subsetting:</p>
  
  <pre><code>data_subset = function(data, date_col) {
  
        if (!TRUE %in% (is.character(date_col) | is.expression(date_col))){
          stop("Input variable date is of wrong format")
        }
  
        if (is.character(date_col)) {
          x &lt;- match(date_col, names(data))
        } else  x &lt;- match(deparse(substitute(date_col)), names(data))
  
          sub &lt;- data[,x]
  }
  </code></pre>
  
  <p>I would like to allow the user to provide the column which should be extracted as character or expression (e.g. a column called "date" vs. just date). At the beginning I would like to check that the input for date_col is really either a character value or an expression. However, 'is.expression' does not work:</p>
  
  <pre><code>Error in match(x, table, nomatch = 0L) : object '...' not found
  </code></pre>
  
  <p>Since deparse(substitute)) works if one provides expressions I thought 'is.expression' has to work as well.
  What is wrong here, can anyone give me a hint?</p>