df1<- seeds_dataset
df1 <- na.omit(df1)
After importing the seeds data set form UC Irvine Machine Learning Repository the data is then saved in an easy to use variable name. Next the data is cleaned by removing any rows that contain any missing information.
PCA <- prcomp(df1[,1:7], scale = T)
df1 <- cbind(df1, PCA$x[,1:3])
Then the PCA is completed on the data frame with only using one command that employs the function prcomp(). Following that the function cbind() is used to bind the first three principle components as column variables into the data frame.