On Mar 3, 2012, at 11:02 AM, Bogaso Christofer wrote:
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?
rbind(Dat[,1:2], Dat[,3:4], Dat[,5:6])
[[alternative HTML version deleted]]
Bogaso;
It is really long past due for you to learn how to send plain text
messages from your mailer.
--
David Winsemius, MD
West Hartford, CT
______________________________________________
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.