Actually, you can wrap this inside of an anonymous function where you call the anonymous function as soon as define it with a (x -> fn(x))(arg1, arg2)
syntax.
Here’s the short version.
@chain df begin
@mutate(a_label = ~categorical((x -> @sprintf("Var = %.1f", x))(a)))
end
…and here I’ve broken it up into 2 steps for readability…
@chain df begin
@mutate(a_label = (x -> @sprintf("Var = %.1f", x))(a))
@mutate(a_label = ~categorical(a_label))
end
Anonymous functions in TidierData.jl should mostly only be needed in situations where your code uses macros (or where you’re using across()
).