title: Filter rows according to their frequency
body: <p>Let's say we have the following data:</p>
  
  <pre><code>library(tidyverse)
  
  data &lt;- tibble(
    V1 = c(1, 1, 1, 1, 2, 2, 1, 3),
    V2 = c(1, 1, 1, 2, 2, 2, 1, 3),
    V3 = c(1, 1, 1, 2, 2, 2, 3, 3),
    V4 = c(1, 1, 1, 2, 2, 2, 3, 3)
  )
  
  &gt; data
  # A tibble: 8 x 4
       V1    V2    V3    V4
    &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
  1     1     1     1     1 ## 1st occurrence 
  2     1     1     1     1 ## 2nd occurrence
  3     1     1     1     1 ## 3rd occurrence
  4     1     2     2     2 ## This row does not count while it occurs only once in the data
  5     2     2     2     2 ## 1st occurrence
  6     2     2     2     2 ## 2nd occurrence
  7     1     1     3     3 ## This row does not count while it occurs only once in the data
  8     3     3     3     3 ## This row does not count while it occurs only once in the data
  </code></pre>
  
  <p>We want to filter out rows which occur more often than a <code>threshold</code>; let's say threshold is set to 2 in our example. Additionally, values of the rows which don't reach the threshold are set to 0. Therefore, the result table should be:</p>
  
  <pre><code>&gt; data_filtered
  # A tibble: 8 x 4
       V1    V2    V3    V4
    &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
  1     1     1     1     1
  2     1     1     1     1
  3     1     1     1     1
  4     0     0     0     0
  5     2     2     2     2
  6     2     2     2     2
  7     0     0     0     0
  8     0     0     0     0
  </code></pre>
  
  <p>Any suggestion is greatly appreciated.</p>