title: Accessing a variable in a ggplot function
body: <p>I have a sample data below</p>
  <pre class="lang-r prettyprint-override"><code>data &lt;- data.frame(yr = c(1999, 2000, 2001, 2002, 2003, 2004, 2005,
                            2006, 2007, 2009, 2010, 2011, 2012), 
                     ntemp =c (11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 12, 23))
  </code></pre>
  <p>When I try running this function, to access the variable inside a ggplot function.</p>
  <pre class="lang-r prettyprint-override"><code>FUN &lt;- function(data, fun.y, yr) {
        fun.data &lt;- data     
        ggplot(fun.data, aes(yr, fun.y)) +
        geom_point() +
        scale_y_continuous(fun.y)    
      }
      
  FUN(data, &quot;ntemp&quot;, yr)
  </code></pre>
  <p>I get an <code>Error in eval(expr, envir, enclos) : object 'fun.y' not found</code></p>
  <p>How can I solve this?</p>