title: get column name based on row values matching in DF in R
body: <p>I have a table like below, would like to crate suggestions based on row value in R studio.</p>
  <p>This is what I have -</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>id</th>
  <th>class1</th>
  <th>class2</th>
  <th>class3</th>
  <th>class4</th>
  <th>top1</th>
  <th>top2</th>
  <th>top3</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>A</td>
  <td>0.98</td>
  <td>0.48</td>
  <td>0.21</td>
  <td>0.99</td>
  <td>0.99</td>
  <td>0.98</td>
  <td>0.48</td>
  </tr>
  <tr>
  <td>B</td>
  <td>0.22</td>
  <td>0.31</td>
  <td>0.41</td>
  <td>0.11</td>
  <td>0.41</td>
  <td>0.31</td>
  <td>0.22</td>
  </tr>
  <tr>
  <td>C</td>
  <td>0.70</td>
  <td>0.81</td>
  <td>0.61</td>
  <td>0.21</td>
  <td>0.81</td>
  <td>0.70</td>
  <td>0.61</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I would like to have names of the column for top1 top2 top3 as well.</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>id</th>
  <th>class1</th>
  <th>class2</th>
  <th>class3</th>
  <th>class4</th>
  <th>top1</th>
  <th>top2</th>
  <th>top3</th>
  <th>top1name</th>
  <th>top2name</th>
  <th>top3name</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>A</td>
  <td>0.98</td>
  <td>0.48</td>
  <td>0.21</td>
  <td>0.99</td>
  <td>0.99</td>
  <td>0.98</td>
  <td>0.48</td>
  <td>class4</td>
  <td>class1</td>
  <td>class2</td>
  </tr>
  <tr>
  <td>B</td>
  <td>0.22</td>
  <td>0.31</td>
  <td>0.41</td>
  <td>0.11</td>
  <td>0.41</td>
  <td>0.31</td>
  <td>0.22</td>
  <td>class3</td>
  <td>class2</td>
  <td>class1</td>
  </tr>
  <tr>
  <td>C</td>
  <td>0.70</td>
  <td>0.81</td>
  <td>0.61</td>
  <td>0.21</td>
  <td>0.81</td>
  <td>0.70</td>
  <td>0.61</td>
  <td>class2</td>
  <td>class1</td>
  <td>class3</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Sample data:</p>
  <p>I have a table like below, would like to crate suggestions based on row value in R studio.</p>
  <p>This is what I have :</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>id</th>
  <th>A</th>
  <th>B</th>
  <th>C</th>
  <th>D</th>
  <th>E</th>
  <th>F</th>
  <th>G</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>A</td>
  <td>0.98</td>
  <td>0.48</td>
  <td>0.21</td>
  <td>0.97</td>
  <td>0.47</td>
  <td>0.20</td>
  <td>0.19</td>
  </tr>
  <tr>
  <td>B</td>
  <td>0.22</td>
  <td>0.31</td>
  <td>0.41</td>
  <td>0.11</td>
  <td>0.42</td>
  <td>0.32</td>
  <td>0.23</td>
  </tr>
  <tr>
  <td>C</td>
  <td>0.70</td>
  <td>0.81</td>
  <td>0.61</td>
  <td>0.21</td>
  <td>0.82</td>
  <td>0.71</td>
  <td>0.62</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I would like to have names of the column for top1 top2 top3 as well.</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>id</th>
  <th>A</th>
  <th>B</th>
  <th>C</th>
  <th>D</th>
  <th>E</th>
  <th>F</th>
  <th>G</th>
  <th>top1name</th>
  <th>top2name</th>
  <th>top3name</th>
  <th>top4name</th>
  <th>top5name</th>
  <th>top6name</th>
  <th>top7name</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>A</td>
  <td>0.98</td>
  <td>0.48</td>
  <td>0.21</td>
  <td>0.97</td>
  <td>0.47</td>
  <td>0.20</td>
  <td></td>
  <td>A</td>
  <td>D</td>
  <td>B</td>
  <td>E</td>
  <td>C</td>
  <td>F</td>
  <td></td>
  </tr>
  <tr>
  <td>B</td>
  <td>0.22</td>
  <td>0.31</td>
  <td>0.41</td>
  <td>0.11</td>
  <td>0.42</td>
  <td>0.32</td>
  <td>0.23</td>
  <td>E</td>
  <td>C</td>
  <td>F</td>
  <td>B</td>
  <td>G</td>
  <td>A</td>
  <td>D</td>
  </tr>
  <tr>
  <td>C</td>
  <td>0.70</td>
  <td>0.81</td>
  <td>0.61</td>
  <td>0.21</td>
  <td>0.82</td>
  <td>0.71</td>
  <td>0.62</td>
  <td>E</td>
  <td>B</td>
  <td>F</td>
  <td>A</td>
  <td>G</td>
  <td>C</td>
  <td>D</td>
  </tr>
  </tbody>
  </table>
  </div>