[R] Questions about cbind

Vincent Deng bioflash at gmail.com
Wed Jan 4 06:28:42 CET 2006


Dear R-helpers

I have a stupid question about cbind function. Suppose I have a
dataframe like this
Frame:
A 10
C 20
B 40

and a numeric matrix like this
Matrix:
A 1
B 2
C 3

cbind(Frame[,2],Matrix[,1]) simply binds these two columns without
checking the order, I mean, the result will be
A 10 1
B 20 2
C 30 3

rather than
A 10 1
B 30 2
C 20 3

So my problem is: Is there any solution for R to bind columns with
correct order?

Many thanks




More information about the R-help mailing list