Tuesday, 15 May 2012

How to Construct a New Matrix with Specified Rows from some given Matrices in R? -


I have 3 matris (called M1, M2, M3). Column 1 of each matrix has some elements (called n elements) which are common among all three. Now I need to create a matrix whose first column belongs to those common elements, and looks like the matrix

  common element 1, the same line of M1, the core. Line of M2, Core M3 General Element 2 row, M1 Coreline, M2 Coreline, M3 Corer line . . . . . . . . . . .   

I need to do this in r

Maybe On the lines of this code some are not included (due to lack of re-presentable examples that you have failed to include.)

  Com12 < - M1 [, 1]% M2 [, 2]] in% 2, [2]] com123 & lt; Com12 [com12 %% m2 [, 3]] cbind (com123, which (com123%% M1 [, 1]), which is 123% in (% m1 [, 2]), which is% m1 [, 3 ] 123%)    

No comments:

Post a Comment