title: Case_when and or if_else dplyr - when NA use values from another column
body: <p>I want to use values from a different column to replace NA values. In this example my last four values in my df have NAs in the "count" column - I want the NA's to be replaced with values from the "value" column.</p>
  
  <p>Here is a dummy data set</p>
  
  <pre><code>df &lt;- structure(list(First = structure(c(17995, 17997, 17929, 17919, 
  17808, 18031, NA, NA, NA, NA), class = "Date"), Last = 
  structure(c(17999, 
  17998, 17929, 17919, 17809, 18031, 17965, 17965, 17965, 17965
  ), class = "Date"), days = c(5, 2, 1, 1, 2, 1, NA, NA, NA, NA
  ), variable = structure(c(4L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 2L, 
  3L), .Label = c("0-12", "0-25", "0-50", "0-100"), class = "factor"), 
  value = c(1, 0, 1, 1, 1, 1, 1, 0, 1, 1), count = c(5, 0, 
  1, 1, 2, 1, NA, NA, NA, NA)), class = "data.frame", row.names = c(NA, 
  -10L))
  </code></pre>
  
  <p>some thoughts of how it might be resolved.... but that are not working due to my poor coding skills:</p>
  
  <pre><code> df &lt;- df %&gt;%
   mutate(a = if_else(count == NA, value, if_else(count &gt;=0, count, a)))
  </code></pre>
  
  <p>or perhaps there is a way with case_when?</p>
  
  <p>Thanks.</p>