[R] help with combination problem

Srinivas Iyyer srini_iyyer_bio at yahoo.com
Wed Jun 7 20:04:18 CEST 2006


hello:

I have 3 data.frame objects.

First df object:
Of dim (149,31). Columns 2:31 are marked as T1..T14 
and N1..N16.

Name     T1    T2    N1   T3   N2  N3  N4  T4
mu1      10    10    9    10   9   9   8   10
mu2      11    11    9    11   9   9   9   11
...
muN      12    12    9    11   9   9   8   12




Second df object:
of Dim (50000,31). Columns 2:31 are maked as T1...T14
and N1..N16.

Name     T1    T2    N1   T3   N2  N3  N4  T4
J1       2     3     20   2    22  21  29   3
J2       4     1     20   3    20  21  22   4
J3       3     1     33   1    31  31  33   3
...
JX       3     2     20   2    21  22  24   2

The column samples are identical in both first and
second data frames. 

Third df object:
of Dim (200,2).  

V1         V2
mu1:J1     -11
mu1:J100   -10.4
mu2:J31     11.3
mu2:J2      10.4
.....       .....
muN:JX     34.5



I want to create a combination of Ts and Ns. Where I
want to subtract value of T-N in all combinations(225
combinations). Such as
T1-N1,T1-N2,T1-N3,T1-N4,T1-N5.......T14-N16

The rows should be the row pairs from 3rd dataframe. 


The final resultant matrix should look like the
following:


      T1-N1  T1-N2  T1-N3  T1-N4  T1-N5.......T14-N16
mu1   1(10-9) 1(10-9)   1    2      1            1
J100  -18(2-20) -20   -19  -27    -20          -29

mu2     1     3        2     2      1            1 
J2     -19   -21     -39    -31    -31         -28



I am a beginner level in R.  I apologise for asking
such a big question and subsequent help. I am unable
to go forward as I have no idea as to how to do this.
Could any one please help me. 
Thanks
sri



More information about the R-help mailing list