title: lm function throws an error in terms.formula() in R
body: <p>I am trying to run linear modelling on the training data frame, but it is not giving me the output. </p>
  
  <p>It gives me an error saying</p>
  
  <pre><code>Error in terms.formula(formula, data = data) : 
  '.' in formula and no 'data' argument
  </code></pre>
  
  <p>Code</p>
  
  <pre><code>n &lt;- ncol(training) 
  input &lt;- as.data.frame(training[,-n])
  fit &lt;- lm(training[,n] ~.,data = training[,-n])
  </code></pre>