title: Convert data.frame column to a vector?
body: <p>I have a dataframe such as:</p>
  
  <pre><code>a1 = c(1, 2, 3, 4, 5)
  a2 = c(6, 7, 8, 9, 10)
  a3 = c(11, 12, 13, 14, 15)
  aframe = data.frame(a1, a2, a3)
  </code></pre>
  
  <p>I tried the following to convert one of the columns to a vector, but it doesn't work:</p>
  
  <pre><code>avector &lt;- as.vector(aframe['a2'])
  class(avector) 
  [1] "data.frame"
  </code></pre>
  
  <p>This is the only solution I could come up with, but I'm assuming there has to be a better way to do this:</p>
  
  <pre><code>class(aframe['a2']) 
  [1] "data.frame"
  avector = c()
  for(atmp in aframe['a2']) { avector &lt;- atmp }
  class(avector)
  [1] "numeric"
  </code></pre>
  
  <p><strong>Note:</strong> My vocabulary above may be off, so please correct me if so.  I'm still learning the world of R.  Additionally, any explanation of what's going on here is appreciated (i.e. relating to Python or some other language would help!)</p>