Run PCA
result <- pca(X, ncomp = 3, center = TRUE, scale. = TRUE) result # will output the eigenvalues, proportional of explain variance in the # case of non missing data
Samples representation
Let us have a first glimpse at the individual plots for the first 2 principal components
plotIndiv(result, comp = c(1, 2), ind.names = TRUE)

Not very useful for the moment. How about adding some colours?
## Let's see how many cell lines types we have we have as.numeric(as.factor(multidrug$cell.line$Class)) ## Now lets add colours to each type of cell line col.drug = as.numeric(as.factor(multidrug$cell.line$Class)) col.drug[col.drug == 1] <- 'red' col.drug[col.drug == 2] <- 'blue' col.drug[col.drug == 3] <- 'yellow' col.drug[col.drug == 4] <- 'violet' col.drug[col.drug == 5] <- 'green' col.drug[col.drug == 6] <- 'black' col.drug[col.drug == 7] <- 'pink' col.drug[col.drug == 8] <- 'brown' col.drug[col.drug == 9] <- 'darkgreen' ## plot of the samples for the first two components plotIndiv(result, comp = 1:2, ind.names = FALSE, col = col.drug, pch = 16) ## Add a legend legend(0.15, -4.5, unique(multidrug$cell.line$Class), col = unique(col.drug), pch = 16, title = "Cancer Cell line", ncol = 3, cex = 0.6)

Same individual plots but in 3D
plot3dIndiv(result, comp = 1:3, ind.names = FALSE, col = col.drug, cex = 0.2, axes.box = "both") ## This command can be used to capture the image on linux rgl.postscript('cs_multi_plotIndiv_final.ps')
