title: How to extract a subset of variables and rename them using the data.frame function in R?
body: <p>I'm new to R and am trying to work with a relatively large data frame.  I am trying to reduce a large data frame to just the variables I need. I kind of figured out how to do that with <code>data.frame</code> function. However, is there a way to change the variable names in the same step?</p>
  
  <p>Example below:</p>
  
  <p>Say my existing dataset has 10 variables (columns): Var1, var2, var3... I only want to leave first 2 variables. So i write:</p>
  
  <pre><code>small_data &lt;- data.frame(var1, var2)
  </code></pre>
  
  <p>So the question is can i somehow change the names of the variables within that <code>data.frame</code> function? </p>