#' Choosing PC's
#'
#' To determine/choose the Principal component Threshold
#' pcThreshold() Determines principle components to use in model based on set threshold
#'
#' @param PC numeric : principal components generated by "prcomp".
#' @param threshold numeric: the chosen amount or proportion of variance explained by the number of principle components to remain in the model.
#' @return PC_T matrix: The chosen number of principal components agreeing with the threshold.
#' @export
pcThreshold <- function(PC, threshold = 0.014)
{
summaryPCA = summary(PC)
pcano = min(which(summaryPCA$importance[2,] < threshold))
PC_T = PC$x[,1:pcano]
return(PC_T)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.