title: Principal Component Analysis in R, ggbiplot
body: <p>I'm a biologist trying to use R, and I'm struggling with it. </p>
  
  <p>I'm trying to generate a Principal Component Analysis for this data:</p>
  
  <pre><code>1,26.96,37.31,35.74
  1,24.27,38.48,37.24
  1,23.58,35.64,40.78
  1,24.29,35.72,39.99
  1,26.43,37.72,35.85
  1,28.80,46.96,24.24
  2,30.05,44.86,25.09
  2,26.59,47.24,26.17
  2,30.55,45.70,23.75
  2,25.95,48.77,25.28
  2,23.31,50.11,26.59
  2,31.29,43.88,24.82
  3,14.70,37.65,47.65
  3,17.11,36.14,46.75
  3,15.83,36.83,47.34
  3,13.77,38.39,47.84
  3,17.76,35.02,47.22
  3,12.90,38.29,48.81
  </code></pre>
  
  <p>The first column correspond to the group variable, I have 3 groups.</p>
  
  <p>I saw <a href="https://tgmstat.wordpress.com/2013/11/28/computing-and-visualizing-pca-in-r/" rel="nofollow">HERE</a>, how to make the graph that I want. But every time I get to the generating biplot part, I get the message: </p>
  
  <blockquote>
    <p>Error: Continuous value supplied to discrete scale.</p>
  </blockquote>
  
  <p>Here is the code that I'm using:</p>
  
  <pre><code>&gt;data(GPA2)
  &gt;head(GPA2, 3) 
  &gt;log.ir &lt;- log(GPA2[, 2:4])
  &gt;ir.group &lt;- GPA2[, 1]
  &gt;ir.pca &lt;- prcomp(log.ir,center = TRUE,scale = TRUE) 
  &gt;print(ir.pca)
  &gt;plot(ir.pca, type = "l")
  &gt;summary(ir.pca)
  &gt;predict(ir.pca, newdata=tail(log.ir, 2))
  &gt;g &lt;- ggbiplot(ir.pca, obs.scale = 1, var.scale = 1, groups = ir.group, ellipse = TRUE, circle = TRUE)
  &gt;g &lt;- g + scale_color_discrete(name = '')
  &gt;g &lt;- g + theme(legend.direction = 'horizontal', legend.position = 'top')
  &gt;print(g)
  </code></pre>
  
  <p>Can anyone help me?</p>