title: ggplot2 not recognizing a column in a function call
body: <p>my code runs well and plots the graphs, when i ran in the consol. however, when i put it in a function, i get an error message indicating that one of the columns could not be found.    </p>
  
  <pre><code>"Error in tapply(X = X, INDEX = x, FUN = FUN, ...) :   
  object 'm.raw' not found"
  </code></pre>
  
  <p>first, the data frame i am using for my plot is exactly as below</p>
  
  <pre><code>DF =
  lbls    raw.1   raw.2   raw.3   m.raw   imp.1   imp.2   imp.3   m.imp
  A1  0.020   0.031   0.032   0.028   11.266  17.408  17.622  15.432
  A2  0.023   0.024   0.036   0.028   12.732  13.452  20.034  15.406
  A3  0.002   0.022   0.016   0.013   1.344   12.111  9.011   7.489
  A4  0.015   0.031   0.021   0.023   8.641   17.575  11.790  12.669
  A5  0.016   0.046   0.066   0.043   8.764   25.728  36.991  23.828
  A7  0.009   0.029   0.029   0.022   4.924   16.348  16.364  12.545
  A7  0.014   0.025   0.029   0.023   7.806   13.747  16.341  12.631
  </code></pre>
  
  <p>second, when i ran the code below in the console (replacing the x and y) with actual variable
  names (x = lbls; y = m.raw), i get the plots without any error message.<br>
  however, when i put the code in a 
  function (replacing the real variable names with x and y) i get an error message indicated above</p>
  
  <pre><code># function to plot
  dot.pa &lt;- function(mydata, x, y) {
    pa &lt;-  ggplot(data = mydata, (aes(x = reorder(x, y), y))) +
      geom_point() +
      labs(x = "predicts", y = "weights") +
      coord_flip()
  
    geom.text.size = 10
    theme.size = (10*1.25) # geom.text.size
  
    pa2 &lt;- pa + theme_minimal() +
      geom_segment(aes(yend=0.00, xend = x)) +
      geom_text(aes(y, label = round(y, 3), 
                family = "mono", size = geom.text.size,
                vjust = -0.5, hjust = 0.9))
  
    pa3 &lt;- pa2 + 
             theme(text = element_text(family = "mono", size = theme.size), 
                   axis.text.x = element_text(size = theme.size, family = "mono"),
                   axis.text.y = element_text(size = theme.size, family = "mono")) +
             theme(legend.position = "none")
    return(pa3)
  }
  
  #plot function
  dot.pa(DF, x=lbls, y=m.raw)
  </code></pre>