title: pivot_wider when there's no value column
body: <p>I'm trying to reshape a dataset from long to wide. The following code works, but I'm curious if there's a way not to provide a value column and still use <code>pivot_wider</code>. In the following example, I have to create a temporary column "val" to use <code>pivot_wider</code>, but is there a way I can do it without it? </p>
  
  <pre><code>a &lt;- data.frame(name = c("sam", "rob", "tom"),
                   type = c("a", "b", "c"))
  a
    name type
  1  sam    a
  2  rob    b
  3  tom    c
  </code></pre>
  
  <p>I want to convert it as the following.</p>
  
  <pre><code>name      a     b     c
  1 sam       1     0     0
  2 rob       0     1     0
  3 tom       0     0     1 
  </code></pre>
  
  <p>This can be done by the following code, but can I do it without creating "val" column (and still using tidyverse language)?</p>
  
  <pre><code>a &lt;- data.frame(name = c("sam", "rob", "tom"),
                  type = c("a", "b", "c"), 
                  val = rep(1, 3)) %&gt;%
    pivot_wider(names_from = type, values_from = val, values_fill = list(val = 0))
  </code></pre>