Description Usage Arguments Value See Also Examples
Plot score matrix for prcomp
(PCA) result based on group
1 2 |
prcompResult |
output object from |
ncomp |
maximum number of PC score to plot |
group |
a vector of numeric, character or factor class separating the samples into groups. |
cex |
(optional) size of points on graphs |
col |
point color palette |
pch |
point type palette |
legendtitle |
legend title |
... |
additional arguments to be passed on to |
A figure is returned on the graphic device
1 2 3 4 5 6 7 8 9 10 11 | data(applejuice)
# country of apple production
country <- sapply(strsplit(names(applejuice), split = "-"), "[", 1)
applejuice_uf <- unfold(applejuice) # unfold list into matrix
result <- prcomp(applejuice_uf)
# plot PC1 vs PC3 score based on country of production
plotScorem(result, ncomp = 4, group = country)
# specify colours
plotScorem(result, ncomp = 4, group = country, col = c("black", "grey"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.