Created
October 7, 2019 18:14
-
-
Save monogenea/4c41d67981d947b4097894172c29baf8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# simple PCA, plot | |
pcaRec <- myRec %>% | |
step_pca(all_predictors()) | |
myPCA <- prep(pcaRec, training = trainSet, retain = T) %>% | |
juice() | |
colGrad <- trainSet$Y/100 # add color | |
plot(myPCA$PC1, myPCA$PC2, | |
col = rgb(1 - colGrad, 0, colGrad,.5), | |
pch = 16, xlab = "PC1", ylab = "PC2") | |
legend("topleft", pch = 16, | |
col = rgb(c(0,.5,1), 0, c(1,.5,0), alpha = .5), | |
legend = c("Pleasant", "Neutral", "Unpleasant"), bty = "n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment