[R] merge two vectors of the same length into one?

Zhiqiang Ye yezhiqiang at gmail.com
Sun Mar 26 18:26:31 CEST 2006


Dear all,

       I have a question about merge two character vectors of the same
length into one.

For example:

      X= c('A', 'B', 'C', 'A', 'D',   .......)      # 26 possible
alphabet values with length 1000
      Y=c('B', 'A', 'C', 'A', 'C',   ........)      # 26 possible
aphabet values with length  1000

     after using table ( X,Y ), I will get a matrix of 26*26.  But I
want to sort these values from large to small, that is to say, I want
to get an output like this;

      AB   75
      AC   60
      CC   58
      ....

How can I get this kind of output?

Thank you very much!


--
Zhiqiang Ye




More information about the R-help mailing list