How can I bring similar columns from two different tables side by side?
2
0
Entering edit mode
2.8 years ago
logbio ▴ 30

I have two files in table format and one of the tables

 Mutate_human main_human ref_human position_human
        aa16bb              aa                bb                    16
        cc17dd              cc                 dd                    17
        ee13ff              ee                 ff                     13

The other table is:

Mutate_mouse   main_mouse     ref_mouse position_mouse
XX16YY                XX        YY            16
ZZ17QQ                ZZ        QQ            17
GG13KK                DD        KK            13

I want to bring similar properties side by side in these tables. For example like this:

  Mutate_human         Mutate_mouse 
    aa16bb                        XX16YY     
    cc17dd                        ZZ17QQ     
    ee13ff                         GG13KK     
Programming R table • 1.6k views
ADD COMMENT
0
Entering edit mode

What do you mean by similar properties? Please provide also complete input example

ADD REPLY
0
Entering edit mode

For example, I want mutate_human and mutate_mouse, main_human and main_mouse columns to be side by side.

ADD REPLY
0
Entering edit mode

use join on common columns between two files.

ADD REPLY
0
Entering edit mode
ADD REPLY
0
Entering edit mode
2.8 years ago
seda ▴ 20

You can use cbind() what you want respectively.

ADD COMMENT
0
Entering edit mode
2.8 years ago
kashiff007 ★ 1.9k
paste human_table.txt mouse_table.txt | awk '{print$1"\t"$5}' > result_table.txt

make sure both input tables have the same number of lines.

ADD COMMENT

Login before adding your answer.

Traffic: 1646 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6