Mutate within custom function throws error

Hi, everyone. I'm trying to create a custom function for some basic counts and percentages of answers to some Likert scale survey questions to make the code shorter, since I have to use it with a lot of questions. It worked at first, but when I tried to add a mutate function into the custom function, to change a variable into a factor variable and arrange the values in an order other than alphabetical order, R gave me an error message (before I could try and use the custom function on any data). Here's the code:

library(tidyverse)
library(janitor)

satisfaction <- function(df, varname) {
  df %>%
    drop_na({{varname}}) %>%
    filter({{varname}} != "Not applicable") %>%
    tabyl({{varname}}) %>%
    adorn_pct_formatting(digits = 0) %>%
    mutate({{varname}} = factor({{varname}},
                        levels = c("Very satisfied",
                                   "Satisfied",
                                   "Neither satisfied nor dissatisfied",
                                   "Dissatisfied",
                                   "Very dissatisfied"))) %>%
    arrange({{varname}})
}

Here's the error message I'm getting:

Error: unexpected '=' in:
"    adorn_pct_formatting(digits = 0) %>%
    mutate({{varname}} ="

If I take the "mutate" and "arrange" lines out of the code, everything works, but the rows in the output objects end up out of order. There must be a way to include "mutate" in a custom function. Am I missing something here?

Thanks for any help anyone can give me.

Lacking any data on which to test this properly, I can propose a couple of possibilities that at least evade the error message. Whether the code will work I cannot say.

One is to change mutate({{varname}} := factor(...)) to mutate({{varname}} = factor(...)). (Note the operator change from = to :=.) The other possibility to try is mutate("{varname}" := factor(...))

Changing the "=" to ":=" worked! Thank you for your help! I tried to look for information on what the difference between the two is, and I've been having a hard time finding a good explanation of what ":=" does, exactly. When would you use ":=" instead of "="?

Honestly, it beats me. It's a tidyverse thing, and I frequently find tidyverse features quite confusing. You can see a bit of an explanation in the name injection section here.

For what it's worth, my path to the answer started by looking at the help entry for mutate and homing in on the "..." argument. It's flagged with a link to help on "data-masking", which is where I came up with the options I suggested.