R/pca.superfamily.R

Defines functions pca.superfamily

Documented in pca.superfamily

#' @title PCA by taxonomic superfamily
#' @description This function runs a PCA on a user-defined taxonomic superfamily
#' @param data dataframe including numerical data as well as information on taxonomic superfamily and family
#' @param superfamily.name superfamily name as it appears in the dataframe
#' @keywords PCA taxonomic
#' @export
#' @examples pca.superfamily(data = d, superfamily.name = "Ceboidea")

pca.superfamily<-function(data, superfamily.name){
  data<-na.omit(data)
  dsup<-filter(data, Superfamily==superfamily.name)
  pcasup<-prcomp(Filter(is.numeric, dsup), center=T, scale=T)
  return(summary(pcasup))
}
lccmyers/taxonpca documentation built on Dec. 21, 2021, 9:45 a.m.