title: Trouble spreading data with pivot_wider huge data frame
body: <p>I have a dataframe with ~400 million rows.  One column is a UID, the Second is a variable, and the third is a column I added which contains a 1.   Here's an example of what I am trying to do with fake data, that looks like my real data.</p>
  <pre><code>df &lt;- data.frame(UID = c(100, 101, 102, 103, 104, 100, 101, 102, 103, 104, 100),
                   Variable = c(&quot;Var_1&quot;, &quot;Var_1&quot;, &quot;Var_2&quot;, &quot;Var_3&quot;, &quot;Var_4&quot;, &quot;Var_4&quot;, &quot;Var_4&quot;, &quot;Var_5&quot;, &quot;Var_5&quot;, &quot;Var_6&quot;, &quot;Var_7&quot;),
                   Indicator = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)))
  
  &gt; df
     UID Variable Indicator
  1  100    Var_1         1
  2  101    Var_1         1
  3  102    Var_2         1
  4  103    Var_3         1
  5  104    Var_4         1
  6  100    Var_4         1
  7  101    Var_4         1
  8  102    Var_5         1
  9  103    Var_5         1
  10 104    Var_6         1
  11 100    Var_7         1
  
  </code></pre>
  <p>This code does what I'd like- Change the <code>Variable</code> Column columns based on the variable within it.</p>
  <pre><code>wide_df &lt;- pivot_wider(df, names_from = Variable, values_from = Indicator)
  
  &gt; wide_df
  # A tibble: 5 x 8
      UID Var_1 Var_2 Var_3 Var_4 Var_5 Var_6 Var_7
    &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
  1   100     1    NA    NA     1    NA    NA     1
  2   101     1    NA    NA     1    NA    NA    NA
  3   102    NA     1    NA    NA     1    NA    NA
  4   103    NA    NA     1    NA     1    NA    NA
  5   104    NA    NA    NA     1    NA     1    NA
  
  </code></pre>
  <p>The problem is that my actual dataset is, I have about ~400 million rows and there are 120 values in the <code>Variable</code> Column.  When I run the code on that, which is set up identically to this one, I get this error:</p>
  <pre><code>Error: Internal error in `compact_rep()`: Negative `n` in `compact_rep()`.
  Run `rlang::last_error()` to see where the error occurred.
  In addition: Warning message:
  In nrow * ncol : NAs produced by integer overflow
  </code></pre>
  <p>I'm not sure what to do next.  I've run into a lot of memory issues creating the file-  I have each UID saved in a file with the Variable name, so if there is a better way to do this, I'm open to that as well!  Any help or pointers on this would be appreciated. The plan is to spread out these columns and join all 120 new columns to another DF.</p>