title: Error message in mutate function: no applicable method for 'mutate_' applied to an object of class "c('double', 'numeric')"
body: <p>Example data frame:</p>
  <pre><code>df &lt;- tibble(x = c('A', 'B', 'C'),
               y = c('D', 'E', 'F'),
               z = c(1, NA, 1))
  </code></pre>
  <p>I want to use the tidyr::fill funtion to replace the NA value in vector z.
  I can do it like this:</p>
  <pre><code>df %&gt;% 
    fill(z, .direction = 'down')
  </code></pre>
  <pre><code># A tibble: 3 x 3
    x     y         z
    &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt;
  1 A     D         1
  2 B     E         1
  3 C     F         1
  </code></pre>
  <p>What I want to try now is to create a new variable while applying the fill() funtion to vector z (so that I keep the original vector z with the NA).
  I tried this:</p>
  <pre><code>df %&gt;% 
    mutate(z2 = fill(z, .direction = 'down'))
  </code></pre>
  <p>But I only get the following error message:</p>
  <pre><code>no applicable method for 'mutate_' applied to an object of class &quot;c('double', 'numeric')&quot;
  </code></pre>
  <p>Why can't I use the tidyr::fill inside the mutate function? What I've learned so far (and I'm relatively new to R), is that I can use other functions inside mutate, such as dplyr::recode, case_when, fct_reorder etc. in order to change an existing vector but then relocate the change to a new variable.</p>
  <p>The end result should look like this:</p>
  <pre><code># A tibble: 3 x 4
    x     y         z    z2
    &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt; &lt;dbl&gt;
  1 A     D         1     1
  2 B     E        NA     1
  3 C     F         1     1
  </code></pre>