Hi all!
I have a reference table of some pathway information that looks like this (rownames and first column are the same)
                [,1]              [,2]                                                
PTHR11566:SF148 "PTHR11566:SF148" "INTERFERON-INDUCED GTP-BINDING PROTEIN MXA-RELATED"
PTHR19353:SF12  "PTHR19353:SF12"  "FATTY ACID DESATURASE 2"                           
PTHR31490:SF39  "PTHR31490:SF39"  ""                                                  
PTHR45744:SF9   "PTHR45744:SF9"   ""                                                  
PTHR16223:SF138 "PTHR16223:SF138" ""                                                  
PTHR45618:SF8   "PTHR45618:SF8"   "MITOCHONDRIAL UNCOUPLING PROTEIN 4"
and I'm trying to use this reference table to give each value in column 2 of this table below (called table2) its appropriate description (which can be found in column 2 of above table)
   [,1]              [,2]                                                
    1             PTHR19353:SF12                            
    2             PTHR19353:SF12                                                                                          
    3             PTHR45618:SF8
The catch is that some values in column 2 above are duplicated, so R only returns unique values but i need all results to be returned. I tried using a list, dataframe, and now a vector to store results of matching, but still having the same issue.
The desired output for my example above would be
PTHR19353:SF12                  FATTY ACID DESATURASE 2   
PTHR19353:SF12                  FATTY ACID DESATURASE 2                                                           
PTHR45618:SF8                   MITOCHONDRIAL UNCOUPLING PROTEIN 4
Here is the code I have going to try to solve this but it is not giving me all the results:
to.fill=c()
for(name in as.character(table2[,2])){
    one=reference.table[name,]
    one.desc=one[2]
    to.fill[name]=one.desc
}
Any idea on how to get around this? Thank you for your input!