How does one recover a character vector for the name of a variable passed to a function that is meant to work with the "new" dplyr programming syntax? The specific problem I am trying to solve is passing to by in a join step inside such a function. Here is a grossly simplified example that I can't make work:
Since by is expecting a character vector, but byvar is an expression (a quosure? I can't keep track) I'm guessing I need to wrap byvar in something, but I can't figure out what. The embrace operator doesn't do it, nor does wrapping the embrace operator in a pair of quotes.
I don't think it's necessary to do the following (though maybe there are cases where we would want to join by a column dynamically created and passed from one function to another), but if you wanted to pass the bare column name, you could convert it to a string inside the function. If by the "embrace" operator you mean {{x}}, this doesn't work because this operator both quotes and unquotes. To get a string, we want to just quote the column name and then use as_label to convert the quosure to a character string. For example: