Description Usage Arguments Details Value See Also Examples
Generates a Principle Component plot for data.frames, matrices,
or a pre-made prcomp
object.
1 2 |
object |
data.frame, matrix or |
pc_x |
integer, principle component for the plot x dimension. |
pc_y |
integer, principle component for the plot y dimension. |
scale |
logical, whether to scale to unit variance before PCA. |
colFactor |
factor or vector, colour the points by this factor,
default is |
pchFactor |
factor or vector, point-type by this factor,
default is |
palette |
string, the function to call to create a vector of
contiguous colours with |
legend |
logical, whether to display a legend on the plot. |
... |
further arguments passed to or from other methods. |
A data.frame object will be coerced internally to a matrix.
Matrices must be of type double
or integer
. The
prcompPlot
function will then perform a principle component analysis
on the data prior to plotting. The function is call
is prcomp(t(object), retx=TRUE, center=TRUE, scale.=scale)
.
Instead of specifying a data.frame or matrix, a pre-made prcomp
object
can be given to prcompPlot
. In this case, care should be taken in
setting the appropriate value of scale.
. If a vector is given to
colFactor
or pchFactor
, they will be coerced internally to
factors.
For the default NULL
values of colFactor
and pchFactor
,
all colours will be black and circles the point type, respectively.
None
1 2 3 4 5 6 7 8 | library(HarmanData)
data(IMR90)
expt <- imr90.info$Treatment
batch <- imr90.info$Batch
prcompPlot(imr90.data, colFactor=expt)
pca <- prcomp(t(imr90.data), scale.=TRUE)
prcompPlot(pca, 1, 3, colFactor=batch, pchFactor=expt, palette='topo.colors',
main='IMR90 PCA plot of Dim 1 and 3')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.