title: How to check if a factor variable has only the levels I want?
body: <p>What's the simplest way to verify a factor variable has the levels I want to?</p>
  
  <pre><code># I want to make sure a factor variable has 'FP', 'TP' but nothing else
  
  a &lt;- factor(c('TP','TP','FP')) # Return TRUE
  b &lt;- factor(c('TP')) # Return TRUE
  c &lt;- factor(c('TP', '1234')) # Return FALSE
  </code></pre>