Open dannyparsons opened 5 years ago
This is also the basis for our calculation system so very important to update correctly.
For dplyr::filter
, since we have the whole expression as a string we need something different, as described here: https://stackoverflow.com/questions/51665956/tidyeval-way-to-programatically-send-values-to-filter/51668207#51668207
filter(iris, !! rlang::parse_expr(string))
Note, this it is not recommend to use string inputs and this would be "better" in tidyverse if we passed in expressions not as strings instead.
The dplyr functions to use variables within their functions has been depreciated and replaced with a different system described here https://dplyr.tidyverse.org/articles/programming.html
There are now warnings that the old functions are depreciated so we need to replace them soon before they are removed completely and will break our code.
Here's an example of the new code which we should be able to adapt for most of our uses:
In general:
rlang::sym()
to convert a string variable (could also userlang::ensym()
)rlang::syms()
to convert a string vector!!
within the function before a single variable!!!
within the function before a vector