title: R function to strip dataframe into individual columns poly
body: <p>I need to update my code in order to make it more dynamic.</p>
  
  <p>My dataframe can sometime contain 6 variables and sometime contain 9 variables. I need to create a dataframe based on the variables in question containing all of the different variables and the corresponding second order variables.</p>
  
  <p>My code used to look like this </p>
  
  <pre><code>df3 &lt;- data.frame(poly(test$hub, test$vacations, test$slot, test$income, test$market_size, test$average_distance_m, degree = 2, raw = TRUE))
  df6 &lt;- data.frame(poly(test$hub, test$vacations, test$slot, test$income, test$market_size, test$average_distance_m, test$noise1, test$noise2, test$noise3, degree = 2, raw = TRUE))
  
  </code></pre>
  
  <p>I was wondering if there was any way to make this more dynamic.
  I tried </p>
  
  <pre><code>df &lt;- data.frame(poly(test, degree = 2, raw = TRUE))
  </code></pre>
  
  <p>where test would update but I keep getting a error in FUN(X, Y, ...) : non-numeric argument to binary operator</p>