my.data.frame <- read.delim("tab_delimited_file_with_probeset_ids_in_first_column.txt", row.names=1) my.data.matrix <- as.matrix(my.data.frame) # PCA by sample: # center each gene (mean) without scaling # scale each sample (root mean square) without centering # transpose the matrix to PCA by sample instead of by gene a <- scale(t(my.data.matrix), center=TRUE, scale=FALSE) b <- scale(t(a), center=FALSE, scale=TRUE) my.pca <- prcomp(t(b), center=FALSE)