title: Check if values in cell and column match values in a list
body: <p>For several hundred columns, I would like to check if values in a given column of df match values in list of df2.</p>
  
  <p>Example data:</p>
  
  <pre><code>df &lt;- data.frame(a=c("1","2","3","4"), b=c("1", NA,NA, "99"))
  df$a &lt;- as.character(df$a)
  df$b &lt;- as.character(df$b)
  df2 &lt;- data.frame(c=I(list(c("1","2","3"))), d=I(list(c("1","0"))))
  
  &gt; df
    a    b
  1 1    1
  2 2 &lt;NA&gt;
  3 3 &lt;NA&gt;
  4 4   99
  
  &gt; df2
          c    d
  1 1, 2, 3 1, 0
  </code></pre>
  
  <p>I have tried the following function:</p>
  
  <pre><code>check &lt;- function(dat1=df, dat2=df2) {
  for(c in ncol(df)) {
   for(r in nrow(df)) {
     df[r,c] &lt;- ifelse(df[r,c] %in% as.character(unlist(df2[1,c])),"match", "nomatch")
      }
  }
  return(df)
  }
  check(df, df2)
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>&gt; check(df, df2)
    a       b
  1 1       1
  2 2    &lt;NA&gt;
  3 3    &lt;NA&gt;
  4 4 nomatch
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>&gt; check(df, df2)
    a       b
  1 match    match
  2 match    &lt;NA&gt;
  3 match    &lt;NA&gt;
  4 nomatch nomatch
  </code></pre>