I have one vector v, created with c(), that has this data:
v[a,b,d,z,e,f], it must be unordered
And I have a txt file with the form:
label 1 2 3 ....
b 100 2000 15
z 123 14 12
a 55 565 55
.....
I have extracted the txt file, that is delimited with tabs with strplit
ext_data<-strsplit(file,"\t")
What I want to do is to see if the elements of vector V matches one of the elements of label, it can be there like not, and after that extract the corresponding elements of the column 1 of the txt file, then the elements of column 2 and so on
I have made the matching using for loop, but is taking too much time, because the txt file contains too much data, like this (algorithmically)
for i=1 to length(v)
for pos=2 to ext_data #I put pos=2 because I start in the second row
if match(vector) and ext_data(pos,1)
retrieve data from column C
Any suggestion?
In rough way what I want is to know if there could be a way to use the match, but with columns, maybe transforming the column label in a row?