plotPCA | R Documentation |
plotPCA
was renamed to plot_pca
for more consistent
function naming nomenclature in OCMSutility
. Usage is still exactly the same
plotPCA(
pc,
metadata,
colourby = "none",
shapeby = "none",
group = "none",
continuous = FALSE,
pcs = c("PC1", "PC2")
)
pc |
prcomp object |
metadata |
metadata dataframe |
colourby |
colour by. default "none" |
shapeby |
shape by. default "none" |
group |
group aes in ggplot. default "none" |
continuous |
is colourby a continuous variable? default FALSE |
pcs |
principal components to plot. default |
list of ggplot pca plot and corresponding dataframe used to make the plot
pca_result <- prcomp(USArrests, scale = TRUE)
state_data <- data.frame(abb = state.abb, area = state.area,
center = state.center, region = state.region,
division = state.division)
rownames(state_data) <- state.name
plotPCA(pca_result, state_data, colourby='division', shapeby='region')
# ->
plot_pca(pca_result, state_data, colourby='division', shapeby='region')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.