In the [latest DataFramesMeta.jl package for Julia](https://github.com/JuliaData/DataFramesMeta.jl/pull/171) one can do

```
x = [:x1, :x2]
n = [:n1, :n2]
@transform(df, cols(x) = :y .+ cols(n))

```

and it will output the columns `x1 = y + x1` and `x2 = y + x2`.

The question, how best to do that in R elegantly? I can do it like this

```
library(dplyr)
df = data.frame(y = 1:3, n1 = 1:3, n2 = 1:3)

x = c("m1", "m2")
n = c("n1", "n2")

code = glue::glue_data(list(x=x, n=n), "{x}=y+{n}")
code = glue::glue("vars({paste(code, collapse=',')})")

mutate(df, !!!eval(parse(text=code)))

```

or in Base

```
res = lapply(n, function(n) {
  df$y + df[, n]
}) %>% data.frame

names(res) <- x

df = cbind(df, res)

```

But it feels hacky. `data.table` and Base solutions welcome.