pca_func: A function for PCA plotting with highlighting groups using...

View source: R/pca_func.R

pca_funcR Documentation

A function for PCA plotting with highlighting groups using ellipses

Description

Beautiful PCA plot

Usage

pca_func(
  data,
  groups,
  title = "",
  print_ellipse = TRUE,
  center = TRUE,
  scale = TRUE
)

Arguments

data

a sample-by-measures numeric matrix. Required

groups

a character vector of sample group assignment. Required

title

a title for the graph. Default: none

print_ellipse

highlight groups by ellipses, Default: TRUE

center

center the data for PCA, see ?prcomp. Default: TRUE

scale

scale the data for PCA, see ?prcomp. Default: TRUE

Value

ggplot2 object

Note

Source: https://shiring.github.io/machine_learning/2017/01/15/rfe_ga_post

Examples

## Not run: 
library(ellipse)
library(ggplot2)
pca_func(iris[, 1:3], groups = iris$Species, title = "Iris")

## End(Not run)

mdozmorov/MDmisc documentation built on Aug. 24, 2022, 9:18 a.m.