Performs a principal components analysis on the given data matrix and returns
the results as an object of class prcomp
.
extractPC(x)
a numeric or complex matrix (or data frame) which provides the gene expression data for the principal components analysis. Genes in the rows and samples in the columns.
A prcomp
object.
m = matrix(rnorm(100),ncol=5)
extractPC(m)
#> Standard deviations (1, .., p=5):
#> [1] 3.170726e+00 2.413504e+00 2.067806e+00 1.938086e+00 2.970886e-16
#>
#> Rotation (n x k) = (20 x 5):
#> PC1 PC2 PC3 PC4 PC5
#> [1,] 0.310977893 -0.06865639 -0.112438657 0.26633488 -0.15029696
#> [2,] -0.463857571 -0.21504003 -0.177777156 0.10141107 0.06054872
#> [3,] 0.204409307 0.02782121 0.283250815 0.34507699 0.50297385
#> [4,] 0.251175038 0.01174769 -0.299018439 -0.06244783 0.66960792
#> [5,] -0.024028285 -0.35844722 0.030526747 0.38100283 0.10702513
#> [6,] -0.111862702 -0.01755458 -0.462627101 -0.10600589 0.06134808
#> [7,] 0.121093058 -0.55469316 -0.052762352 -0.21899050 0.12934575
#> [8,] 0.149858161 0.02373739 -0.188417976 -0.30403529 -0.16312653
#> [9,] -0.190741780 0.48184682 -0.107879998 -0.09304583 0.21268294
#> [10,] -0.192335145 0.01507630 -0.186177932 -0.03250441 0.14817543
#> [11,] -0.026948531 -0.36647785 0.010775017 -0.33315629 -0.06538003
#> [12,] 0.005514519 -0.02701274 0.125484426 0.13762531 -0.06660812
#> [13,] 0.327511952 0.25365671 -0.397799548 0.07471330 -0.17831754
#> [14,] -0.041665341 0.17185796 0.368269911 0.08871858 -0.13081173
#> [15,] -0.368301527 0.07220185 -0.011303243 -0.03957643 0.08404394
#> [16,] 0.076321337 -0.15873718 0.064170701 0.05460422 -0.04182739
#> [17,] -0.010855195 0.12295681 0.368239212 -0.43854176 0.22689941
#> [18,] -0.291209190 -0.02681791 -0.006205672 0.03904063 -0.05509745
#> [19,] -0.113594498 0.04574835 -0.187584711 0.35667576 -0.08107403
#> [20,] -0.332592803 -0.03787068 -0.042031002 0.14247609 0.13825206