- Launch R and open a new script by selecting File and then New script.
- In the R Editor window, enter the following code and make sure to replace all of the file paths with the paths leading to the appropriate locations on your device. After pasting the paths, make sure to replace the backslashes with double backslashes, as seen in the following code:
pt <-read.table ("C:\\Users\\Slaven\\Desktop\\personality_ traits.csv", header=T, sep=",")pt.pc <- prcomp(pt, scale = TRUE)X1 <- pt.pc$x [, 1]X2 <- pt.pc$x [, 2]X3 <- pt.pc$x [, 3]X4 <- pt.pc$x [, 4]X5 <- pt.pc$x [, 5]scores <- cbind(pt, X1, X2, X3, X4, X5) colnames(scores)[17] <- "X1"colnames(scores)[18] <- "X2"colnames(scores)[19] <- "X3"colnames(scores)[20] <- "X4"colnames(scores)[21] ...