[R] Extracting columns

Silvano Cesar da Costa silvano at uel.br
Thu Nov 8 16:50:02 CET 2012


Hi,

I have 22 files (A1, A2, ..., A22) with different number of columns,
totaling 10,000 columns: c1, c2, c3, ..., c10000

I have another file with a list of 100 columns that I need to extract.
These 100 columns are distributed in 22 files.

How to extract the 100 columns of the 22 files?

I have done it "manually" with the following commands, for example:

cromo1 = read.table ("~ / cromo1.raw ', head = T)
c1 = subset (cromo1, select = c ('c1', 'c50', 'C750'))

in this case, I know that the columns c1, c50 and C750 are on cromo1.raw.
See who need to apply the commands above 22 times.

Is there a way to schedule these operations?


---------------------------------------------
Silvano Cesar da Costa

Universidade Estadual de Londrina
Centro de Ciências Exatas
Departamento de Estatística

Fone: (43) 3371-4346



More information about the R-help mailing list