title: Object not found when creating an R function
body: <p>dataframe I am trying to create a function based on a bit of code that works so I can replicate it further.</p>
  <pre><code>nap_analyse &lt;- nap_analyse %&gt;%
    mutate(is.beekper = as.logical(replace(About_yourself.Beekeeper, !is.na(About_yourself.Beekeeper), TRUE))) %&gt;%
    mutate(is.beekper = replace_na(is.beekper, FALSE)) 
  </code></pre>
  <p>The above code seems to work well and therefore I am trying to create the function below:</p>
  <pre><code>new_nap_var &lt;- function(dataframe, new_var, var_to_replace) {
    dataframe &lt;- dataframe %&gt;%
      mutate(new_var = as.logical(replace(var_to_replace, !is.na(var_to_replace), TRUE))) %&gt;%
      mutate(new_var = replace_na(new_var, FALSE))
  }
  </code></pre>
  <p>However, when I run <code> new_nap_var(nap_analyse, is.beekeeper, About_yourself.Beekeeper)</code> I get the error:</p>
  <blockquote>
  <p>Error: Problem with <code>mutate()</code> input <code>new_var</code>.
  x object 'About_yourself.Beekeeper' not found
  ℹ Input <code>new_var</code> is <code>as.logical(replace(var_to_replace, !is.na(var_to_replace), TRUE))</code>.
  Run <code>rlang::last_error()</code> to see where the error occurred.</p>
  </blockquote>
  <p>How can I make this work? Many thanks!</p>