title: Addressing x and y in aes by variable number
body: <p>I need to draw a scatterplot with addressing variables by their column numbers instead of names, i.e. instead of <code>ggplot(dat, aes(x=Var1, y=Var2))</code> I need something like <code>ggplot(dat, aes(x=dat[,1], y=dat[,2]))</code>. (I say 'something' because the latter doesn't work).</p>
  
  <p>Here is my code:</p>
  
  <pre><code>showplot1&lt;-function(indata, inx, iny){
    dat&lt;-indata
    print(nrow(dat)); # this is just to show that object 'dat' is defined
    p &lt;- ggplot(dat, aes(x=dat[,inx], y=dat[,iny]))
    p + geom_point(size=4, alpha = 0.5)
  }
  
  testdata&lt;-data.frame(v1=rnorm(100), v2=rnorm(100), v3=rnorm(100), v4=rnorm(100), v5=rnorm(100))
  showplot1(indata=testdata, inx=2, iny=3)
  </code></pre>
  
  <blockquote>
  <pre><code># Error in eval(expr, envir, enclos) : object 'dat' not found
  </code></pre>
  </blockquote>