title: How to check if set A is subset of set B in R?
body: <p>I have two sets A and B. I want to check if set A is a subset of set B. I have tried I am aware of the set operation in R. I have tried intersect, union, setdiff. However, non of them were helpful. For example, </p>
  
  <pre><code>A = c(1, 2, 3, 4)
  </code></pre>
  
  <p><code>B = c(1, 2, 3, 4, 5)</code></p>
  
  <p>I am looking for a function that returns TRUE or FALSE. 
  I have used <code>A %in% B</code> and compare the sum and length, which does the same job. But I feel like there is a beter way of doing this. </p>
  
  <p><code>length(A %in% B) == sum(A %in% B)</code> returns <code>TRUE</code> and 
  <code>length(B %in% A) == sum(B %in% A)</code> returns <code>FALSE</code>. </p>