title: Checking every column in a dataset for certain values in a while loop?
body: <p>I want to write code that simulates data, then checks if the resulting dataframe has contains certain values at least once in each column. So How do I do that? I came up with the following ( for a dataset with 5 columns needing to contain 0,1 and 2 at least once each in every column)but it checks every column together and I'm out of ideas how to fix that.</p>
  <pre><code>while (sum(datasimulated[,1:5]==0)&lt;1 &amp;&amp;
             sum(datasimulated[,1:5]==1)&lt;1 &amp;&amp;
             sum(datasimulated[,1:5]==2)&lt;1) {
        datasimulated&lt;-simdata(pars[[i]][[&quot;a&quot;]],pars[[i]][[&quot;d&quot;]], N=ns[i], itemtype = &quot;gpcm&quot;)
      }
  </code></pre>