title: Import column names from step wise regression in R
body: <p>I want to import the variables selected from the step-wise regression process as column names so that I have the "Output" has the variables from the step-wise regression as shown below. But, my code below does NOT do that. </p>
  
  <p>I cannot understand what I am doing wrong here. Can somebody help me please?</p>
  
  <pre><code>iris$area &lt;- iris$Petal.Length * iris$Petal.Width
  iris &lt;- data.table(iris)
  mydata &lt;- iris[Species %in% "virginica", list(Sepal.Length,Sepal.Width,Petal.Length,Petal.Width,area)]
  
  fit &lt;- lm(area~., data=mydata)
  satis.step &lt;- step(fit, direction="both")
  datanew &lt;- iris[Species %in% "virginica", list(Species, paste(attr(satis.step$formula, "term.labels"),collapse = ", ")) ]
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <p>I need the output to look like:</p>
  
  <pre><code>Species       Sepal.Length     Sepal.Width
  ------------------------------------------
  virginicia         6.3            3.3
  virginicia         5.8            2.7
  </code></pre>