Divide a column by itself with mutate_at dplyr Hi I'd like to turn each non zero value of my selected columns to a 1 using mutate_at()

 BRAND  MEDIA_TYPE    INV1       INV2
   &lt;chr&gt;  &lt;chr&gt;      &lt;dbl&gt;     &lt;dbl&gt;
  b1     newspapers    2         27
  b1     magazines     3         0
  b2     newspapers    0         0
  b3     tv            1        145
  b4     newspapers    4         40
  b5     newspapers    5         0
  b1     newspapers    1         0
  b2     newspapers    0         28


The final result should be like follow:

 BRAND  MEDIA_TYPE    INV1      INV2
   &lt;chr&gt;  &lt;chr&gt;      &lt;dbl&gt;     &lt;dbl&gt;
  b1     newspapers    1         1
  b1     magazines     1         0
  b2     newspapers    0         0
  b3     tv            1         1
  b4     newspapers    1         1
  b5     newspapers    1         0
  b1     newspapers    1         0
  b2     newspapers    0         1


Do you have any suggestion on how to solve it?
Thank you!!
mutate_at(my_data, vars(starts_with("INV")), sign)


Although I see your INV1 column is a date? I'm not sure how much that'll affect things..