[R] plotting pca of samples in different colors

Amit amitkumartiwary at gmail.com
Sun Apr 18 15:46:46 CEST 2010

Hi! All,

I am working on a dataset 'rat' with dimension 20500x363. I have
calculated pca of samples (columns). Now I am trying to plot first two
principle components with specified columns in different color. I have
done following so far:

> dim(rat)
[1] 20500   363
>#specifying columns to be colored in red
> a1=colnames(rat[,c(1,5,9,12,16,154,227,276,284,298,305,311,318,336,338,drop=F)])
>#specifying columns to be colored in blue
> a2=colnames(rat[,c(2,3,4,6,13,14,drop=F)])
>#specifying columns to be colored in green
> a3=colnames(rat[,c(7,8,10,11,15,29,35,36,50,54,57,59,61,63,70,71,79,99,110,132,147,163,166,215,275,drop=F)])
>#specifying columns to be colored in brown
> d=colnames(rat[,-c(1,5,9,12,16,154,227,276,284,298,305,311,318,336,338,2,3,4,6,13,14,7,8,10,11,15,29,35,36,50,54,57,59,61,63,70,71,79,99,110,132,147,163,166,215,275,drop=F)])
>#calculating pca for columns
> rat_pca=prcomp(t(rat),scale=T)

But after executing last command there is nothing plotted in the graph
and it also does not give any error. Please help!


More information about the R-help mailing list