# R/auto.pca.R In auto.pca: Automatic Variable Reduction Using Principal Component Analysis

#### Documented in auto.pca

```#' @title auto.pca
#'
#' @description PCA done by eigenvalue decomposition of a data correlation matrix, usually determines the number of factors by eigenvalue greater than 1 and automatically it gives the uncorrelated variables
#'
#' @param input_data
#'
#' @return Uncorrelated_Variables
#'
#' @examples auto.pca(attitude)
#'
#' @export

auto.pca<-function(input_data){

input_data<-Filter(is.numeric,input_data) # Takes only numerical values

eigen_Value <- eigen(cor(input_data)) # Calculating Eigen Value

eigen_Value<-round(eigen_Value\$values,digits=2)

nfactors<-length(eigen_Value[eigen_Value>1]) # Count of Eigen Value greater than 1 determines the number of factors

print(paste("Number of Factors identified based on eigen Value greater than 1 :",nfactors,"Factors"))

pca<-principal(input_data,nfactors=nfactors,rotate="varimax",scores=T)

print(pca)

cat('\n','################################################################')

cat('\n','#############  Uncorrelated Variables Identified  ##############')

cat('\n','################################################################')

cat('\n','                                                                ','\n')

return(Select_PC)
}
```

## Try the auto.pca package in your browser

Any scripts or data that you put into this service are public.

auto.pca documentation built on Sept. 12, 2017, 5:03 p.m.