See this example where dplyr does autocompletion:
I just typed my_ and a select menu appears including objects beginging with my_ inside the global environment and inside of df. On the other hand, see what happens if I type same first letters inside my own function my_fun`:
As you can see, here only the my_fun from the global environment appears in the list but the two variable names from df are missing! Can we do the autocompletion list as in the first screenshot for a user defined function?
Code. But keep in mind that this selection menu does not appear if you copy paste the first letters my_ - you have to actually type in my_ and then the menu appears.
df <- data.frame(my_var1= 1:5, my_var2= 6:10)
my_fun <- function(data, var){mean(data[ , var])}
df %>% mutate(my_)
my_fun(data= df, var= my_)
Edit: I want it to be "live", so the menu selection appears right after the first letters, i.e. user does not need to run code.




