R/pcaPopulationPlot.R

Defines functions pcaPopulationPlot

Documented in pcaPopulationPlot

#' PCA Plot for Set of Attributes in a population
#'
#' This function will display a PCA plot of n attributes to see how
#' closely related certain species are related to each other
#'
#'
#' @param attributeSet The set of attributes
#' @return Returns a PCA plot of different species relatedness
#'
#'
#' @examples
#' pcaPopulationPlot(mtcars)
#'
#'
#'
#' @export
#' @rawNamespace import(stats, except = filter)
#' @import ggbiplot stats

pcaPopulationPlot <- function(attributeSet) {

  #store attribute set into popPCA
  popPCA <- prcomp(attributeSet, center = TRUE, scale = TRUE)

  #plot popPCA into a plot
  populationPlot <- ggbiplot(popPCA, labels=rownames(popPCA))
  return(populationPlot)
}

# [END]
Heffley/PopGenAnalysis documentation built on Dec. 17, 2021, 10:32 p.m.