R/PCA.R

Defines functions PCA

Documented in PCA

#' PCA
#' generates the PCA from the provided numeric data
#' @param my_data_clean_PCA data including all numeric featrurs ready for the PCA
#'
#' @return pca_fit
#' @export
#'
#' @examples
PCA <- function(my_data_clean_PCA){
  pca_fit <- my_data_clean_PCA %>%
    select(where(is.numeric)) %>% # retain only numeric columns
    prcomp(scale = TRUE) # do PCA on scaled data
  return(pca_fit)
}
rforbiodatascience22/PanRISK_package documentation built on April 24, 2022, 12:15 a.m.