title: combine mutate(across) and case_when to fill multiple columns with 0 depending on condition
body: <p>In a dplyr workflow I try to paste a 0 in each column of a dataframe after the newvar column when newvar == 0, else do nothing.
  I modified the iris dataset:</p>
  <pre><code>library(dplyr)
  n &lt;- 150 # sample size
  
  iris1 &lt;- iris %&gt;% 
      mutate(id = row_number(), .before = Sepal.Length) %&gt;% 
      mutate(newvar = sample(c(0,1), replace=TRUE, size=n), .before = Sepal.Length ) %&gt;% 
      mutate(across(.[,3:ncol(.)], ~ case_when(newvar==0 ~ 0)))
  </code></pre>
  <p>I tried a solution like here <a href="https://stackoverflow.com/questions/64668137/how-to-combine-the-across-function-with-mutate-and-case-when-to-mutate">How to combine the across () function with mutate () and case_when () to mutate values in multiple columns according to a condition?</a>.
  My understanding:</p>
  <ol>
  <li>with <code>.[,3:ncol(.)]</code> I go through the columns after newvar column.</li>
  <li>with <code>case_when(newvar==0</code> I try to set the condition.</li>
  <li>with <code>~ 0</code> after <code>newvar==0</code> I try to say paste 0 if condition is fulfilled.</li>
  </ol>
  <p>I know that I am doing something wrong, but I don't know what! Thank you for your help.</p>