Hi all, let say I have following matrix:

 

> Dat <- matrix(1:30, 5, 6); colnames(Dat) <- rep(c("Name1", "Names2"), 3)

> Dat

     Name1 Names2 Name1 Names2 Name1 Names2

[1,]     1      6    11     16    21     26

[2,]     2      7    12     17    22     27

[3,]     3      8    13     18    23     28

[4,]     4      9    14     19    24     29

[5,]     5     10    15     20    25     30

 

>From this matrix, I want to create another matrix with 2 columns for "Name1"
and "Name2". Therefore, my final matrix will have 2 columns and 15 rows. Is
there any direct R function to achieve this?

 

Thanks and regards,


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to