subset of prcomp object in R
<p>I'm basically computing the PCA for a set of variables and everything works fine. Lets say I'm using the iris data as an example, but my data is different. The iris data should be sufficient to explain my question:</p>

<pre><code>data(iris)
log.ir &lt;- log(iris[, 1:4])
log.ir[mapply(is.infinite, log.ir)] &lt;- 0
ir.groups&lt;- iris[, 5]
ir.pca &lt;- prcomp(log.ir, center = TRUE, scale. = TRUE) 

library(ggbiplot)

g &lt;- ggbiplot(ir.pca, obs.scale = 1,var.scale = 1,groups = ir.groups, var.axes=F)
g &lt;- g + scale_color_discrete(name = '')
g &lt;- g + theme(legend.direction = 'horizontal', 
               legend.position = 'top') + theme(legend.text=element_text(size=15), legend.key.size = unit(2.5, "lines")) + theme(text = element_text(size=20))
ggsave("pca2.pdf", g, width=15, height=15)
</code></pre>

<p>When I get the plot, some groups are plotted too close together so I want to make a new plot for this subset of groups (without computing a new PCA for the subset).</p>

<p>Is there a way to make a subset of the <code>ir.pca</code> object to select only specific <code>groups</code> to plot?</p>