Learn R Programming

specmine (version 1.0)

pca_kmeans_plot2D: 2D PCA k-means plot

Description

Groups the points with the clusters given by k-means in a 2D PCA scores plot.

Usage

pca_kmeans_plot2D(dataset, pca.result, num.clusters = 3, pcas = c(1, 2), kmeans.result = NULL, labels = FALSE, ellipses = FALSE, leg.pos = "right", xlim = NULL, ylim = NULL)

Arguments

dataset
list representing the dataset from a metabolomics experiment.
pca.result
prcomp object with the PCA results.
num.clusters
number of clusters of k-means.
pcas
vector with the principal components to be plotted.
kmeans.result
result from k-means. If null k-means is performed in the function.
labels
boolean value indicating if the samples' labels will be shown.
ellipses
boolean value that indicates if an ellipse will be drawn on each group of the metadata's variable.
leg.pos
legend position.
xlim
vector with two positions with the x-axis limits.
ylim
vector with two positions with the y-axis limits.

Examples

Run this code
## Not run: 
#   ## Example of a 2D PCA k-means plot
#   data(cachexia)
#   pca.result = pca_analysis_dataset(cachexia)
#   pca_kmeans_plot2D(cachexia, pca.result, num.clusters = 3, pcas = c(1,2))
# ## End(Not run)

Run the code above in your browser using DataLab