title: lda returns only LD1
body: <p>I tried the following code related to lda and could not understand why it did not returns LD2 besides LD1.</p>
  
  <pre><code>library(MASS)
  library(ggplot2)
  </code></pre>
  
  <p>load function <code>ggplotLDAPrep()</code> from <a href="https://stackoverflow.com/questions/28781885/how-to-plot-the-results-of-a-lda">here</a>:</p>
  
  <pre><code>ggplotLDAPrep &lt;- function(x){
    if (!is.null(Terms &lt;- x$terms)) {
      data &lt;- model.frame(x)
      X &lt;- model.matrix(delete.response(Terms), data)
      g &lt;- model.response(data)
      xint &lt;- match("(Intercept)", colnames(X), nomatch = 0L)
      if (xint &gt; 0L) 
        X &lt;- X[, -xint, drop = FALSE]
    }
    means &lt;- colMeans(x$means)
    X &lt;- scale(X, center = means, scale = FALSE) %*% x$scaling
    rtrn &lt;- as.data.frame(cbind(X,labels=as.character(g)))
    rtrn &lt;- data.frame(X,labels=as.character(g))
    return(rtrn)
  }
  
  
  test&lt;-iris[grep("setosa|virginica", iris$Species),1:5]
  ldaobject &lt;- lda(Species ~ ., data=test)
  fitGraph &lt;- ggplotLDAPrep(ldaobject)
  ggplot(fitGraph, aes(LD1,LD2, color=labels))+geom_point()
  ldaobject
  </code></pre>
  
  <p>Any insight ?</p>