title: Check for match in one column of data frame to one of multiple other columns in R
body: <p>Let's say I have a df with 4 columns. How can I add a column that indicates whether the string in col 1 matches a string in any of cols 1-3?</p>
  <p>df</p>
  <pre><code>    species_A   species_1   species_2   species_3
  1   Clostridium breve   Clostridium breve   Eggerthella lenta   Bacillus cereus
  2   Splactus blandum Splactus plantarum Splactus pentosus Clostridium adolescentis
  3   Rotoroides ovatus   Rotoroides ovatus Pseudomonas oryzihabitans Stenotrophomonas maltophilia
  4   Bacillus licheniformis  Phytorotor sp.  Cutirotorium acnes  Rotoroides ovatus
  5   Clostridium longum  Clostridium longum  Sphingomonas melonis    Phytorotor sp.
  6 Odorirotor splanchnicus   Clostridium longum  Odorirotor splanchnicus Stenotrophomonas maltophilia
  </code></pre>
  <p>I want to add a column 'match' with T/F on whether species_A matches species_1 OR species_2 OR species_3:</p>
  <pre><code>    species_A   species_1   species_2   species_3   Matches
  1   Clostridium breve   Clostridium breve   Eggerthella lenta   Bacillus cereus TRUE
  2   Splactus bandum Splactus plantarum  Splactus pentosus Clostridium adolescentis  TRUE
  3   Rotoroides ovatus   Rotoroides ovatus Pseudomonas oryzihabitans Stenotrophomonas maltophilia    TRUE
  4   Bacillus licheniformis  Phytorotor sp.  Cutirotorium acnes  Rotoroides ovatus   FALSE
  5   Clostridium longum  Clostridium longum  Sphingomonas melonis    Phytorotor sp.  TRUE
  6 Odorirotor splanchnicus   Clostridium longum  Odorirotor splanchnicus Stenotrophomonas maltophilia    TRUE
  </code></pre>
  <p>Based on other threads I've tried using lapply and sapply, but I can't seem to feed the species_A column as a set of patterns.</p>
  <pre><code>lapply(df[2:4], function(x) match(x, d$species_A))
  
  sapply(df[2:4],
                function(x) grepl(d$species_A, x, ignore.case = TRUE))
  </code></pre>