title: Mutating dummy variables in dplyr
body: <p>I want to create 7 dummy variables -one for each day, using dplyr</p>
  
  <p>So far, I have managed to do it using the <code>sjmisc</code> package and the <code>to_dummy</code> function, but I do it in 2 steps -1.Create a df of dummies, 2) append to the original df</p>
  
  <pre><code>#Sample dataframe
  mydfdata.frame(x=rep(letters[1:9]),
             day=c("Mon","Tues","Wed","Thurs","Fri","Sat","Sun","Fri","Mon"))
  
  #1.Create the 7 dummy variables separately
  daysdummy&lt;-sjmisc::to_dummy(mydf$day,suffix="label")
  
  #2. append to dataframe
  mydf&lt;-bind_cols(mydf,daysdummy)
  
  
  &gt; mydf
    x   day day_Fri day_Mon day_Sat day_Sun day_Thurs day_Tues day_Wed
  1 a   Mon       0       1       0       0         0        0       0
  2 b  Tues       0       0       0       0         0        1       0
  3 c   Wed       0       0       0       0         0        0       1
  4 d Thurs       0       0       0       0         1        0       0
  5 e   Fri       1       0       0       0         0        0       0
  6 f   Sat       0       0       1       0         0        0       0
  7 g   Sun       0       0       0       1         0        0       0
  8 h   Fri       1       0       0       0         0        0       0
  9 i   Mon       0       1       0       0         0        0       0
  </code></pre>
  
  <p>My question is whether I can do it in one single workflow using <code>dplyr</code> and add the <code>to_dummy</code> into the pipe-workflow- perhaps using <code>mutate</code>?</p>
  
  <p>*<code>to_dummy</code> <a href="https://www.rdocumentation.org/packages/sjmisc/versions/2.6.3/topics/to_dummy" rel="noreferrer">documentation</a></p>