Hi,
I have got a large tab-delimited data file like this;
OTU Sample Abundance Kingdom Phylum Class Order Family
OTU1 1D_M2 0.000233111 Bacteria Bacteroidetes Bacteroidia Bacteroidales Marinilabiliaceae
OTU1 1D_M1 9.96E-05 Bacteria Bacteroidetes Bacteroidia Bacteroidales Marinilabiliaceae
OTU1 1D_R1 8.82E-05 Bacteria Bacteroidetes Bacteroidia Bacteroidales Marinilabiliaceae
OTU2 2W_R2 8.41E-06 Bacteria Proteobacteria Deltaproteobacteria Desulfobacterales Desulfobulbaceae
OTU2 2W_M1 8.37E-06 Bacteria Proteobacteria Deltaproteobacteria Desulfobacterales Desulfobulbaceae
OTU2 1D_R1 5.21E-06 Bacteria Proteobacteria Deltaproteobacteria Desulfobacterales Desulfobulbaceae
I want to get all rows that match to list of OTU that in the separated file like this
OTU1
OTU2
OTU3..........
Like if I want to get OUT1 then it should give me output like this;
OTU Sample Abundance Kingdom Phylum Class Order Family
OTU1 1D_M2 0.000233111 Bacteria Bacteroidetes Bacteroidia Bacteroidales Marinilabiliaceae
OTU1 1D_M1 9.96E-05 Bacteria Bacteroidetes Bacteroidia Bacteroidales Marinilabiliaceae
OTU1 1D_R1 8.82E-05 Bacteria Bacteroidetes Bacteroidia Bacteroidales Marinilabiliaceae
Many thanks
try
df[df$OTU==list,]
orsubset(df, OTU %in% list)
thank you so much, this code is working perfectly;
Split your data into list, each list item will have data for 1 OTU, something like