How to do it…

  1. Launch R and open a new script by selecting File and then New script.
  2. 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] ...

Get Tableau 2019.x Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.