I have read a few stackoverflow questions on NSE with dplyr (here, here and here), but I am still struggling to apply it to my use.
This is my example
This work
yo <- tibble(ah = 1:10, meh = 11:20)
yup <- yo %>% select(ABX = meh)
But I would like to make this work:
i=1
newnames <- c("ABX", "TDX")
yup <- yo %>% select(newnames[i] = meh)
A few things, I have tried without success:
yup <- yo %>% select_(newnames[i] = "meh")
yup <- yo %>% select(!!rlang::sym(newnames[i]) = meh)
yup <- yo %>% select(as.name(newnames[i]) = meh)
Any help? Thanks in advance.