PCA Scaling with ggbiplot
I'm trying to plot a principal component analysis using prcomp and ggbiplot . I'm getting data values outside of the unit circle, and haven't been able to rescale the data prior to calling prcomp in such a way that I can constrain the data to the unit circle. data(wine) require(ggbiplot) wine.pca=prcomp(wine[,1:3],scale.=TRUE) ggbiplot(wine.pca,obs.scale = 1, var.scale=1,groups=wine.class,ellipse=TRUE,circle=TRUE) I tried scaling by subtracting mean and dividing by standard deviation before calling prcomp : wine2=wine[,1:3] mean=apply(wine2,2,mean) sd=apply(wine2,2,mean) for(i in 1:ncol(wine2)