This function performs Principal Component Analysis (PCA) on a dataset, and visualizes the results in various ways, including a scatter plot of the first two principal components (PC1 vs PC2) and a Van Krevelen plot projected using PC1 values. The PCA is performed on the molecular formula data, aggregated by a grouping variable, and handles cases where columns exhibit zero variance (which cannot be included in PCA).
uplot_pca(
mfd,
grp,
int_col = "norm_int",
palname = "viridis",
col_bar = TRUE,
...
)A list containing:
The PCA model object (class prcomp).
A data table of PCA scores (principal component values for each sample).
A Van Krevelen plot projected with PC1 values.
A scatter plot of the first two principal components (PC1 vs PC2).
The input data table, augmented with principal component values.
data.table with molecular formula data as derived from
ume::assign_formulas. Column names of elements/isotopes must match names in
the isotope column of ume::masses; values are integers representing
counts per formula.
Character vector. Names of columns (e.g., sample or file identifiers) used to aggregate results.
Character. The name of the column that contains the intensity values to be used (e.g. for clustering or color coding). Default usually is "norm_int" for normalized intensity values.
Color palette name for f_colorz() (viridis, magma, plasma, etc.).
Logical. If TRUE, adds a color legend (default is TRUE).
Additional arguments passed to methods.
Principal Component Analysis (PCA) Plotting
uplot_vk for the Van Krevelen plot function.
Other plots:
uplot_cluster(),
uplot_cvm(),
uplot_dbe_minus_o_freq(),
uplot_dbe_vs_c(),
uplot_freq_ma(),
uplot_freq_vs_ppm(),
uplot_hc_vs_m(),
uplot_heteroatoms(),
uplot_isotope_precision(),
uplot_kmd(),
uplot_lcms(),
uplot_ma_vs_mz(),
uplot_ms(),
uplot_n_mf_per_sample(),
uplot_ratios(),
uplot_reproducibility(),
uplot_ri_vs_sample(),
uplot_vk()