I am writing a simple function using `tidyeval` where I need to pass the arguments to the formula interface. Although I have managed to build a working version of the function, it doesn't seem to work with `for` loops.

function
========

```r
foo <- function(data, x, y) {
  BayesFactor::ttestBF(
    paired = FALSE,
    data = data,
    formula = rlang::new_formula(rlang::enexpr(y), rlang::enexpr(x))
  )
}

foo(mtcars, am, wt)
#> Bayes factor analysis
#> --------------
#> [1] Alt., r=0.707 : 1383.367 ±0%
#> 
#> Against denominator:
#>   Null, mu1-mu2 = 0 
#> ---
#> Bayes factor type: BFindepSample, JZS

```

working with loops
==================

I also tried here `!!col.name[i]`

```r
df <- dplyr::select(mtcars, am, wt, mpg)
col.name <- colnames(df)

for (i in 2:length(col.name)) {
  foo(
    data = mtcars,
    x = am,
    y = col.name[i]
  )
}
#> Error in `[.data.frame`(data, , dv): undefined columns selected

```