I have one large text table, tab separated. The first row is a header. I then have a second text file that contains a subset of the headers in the first file. I want to extract all the columns of the first file whose header is contained in the list given in the second file. Here an example of the inputs and the desired output:
DATA.TXT
head0 head1 head2 head3 head4
1 25 1364 22 13
2 10 215 1 22
LIST.TXT
head0
head4
Desired output:
head0 head4
1 13
2 22
Can we have a few actual examples of the header names? It's easy if they do actually end 0, 1, 2, 3 ... but I assume they don't?
How can i do it in R? Thanks
How can i do it in R? Thanks